Escape strings before writing them to the log.

This fixes: https://github.com/TheTorProject/ooni-probe/issues/302 for ooni-probe