Escape strings before writing them to the log.

This fixes: https://github.com/TheTorProject/ooni-probe/issues/302 for ooni-probe
Merge pull request #308 from TheTorProject/fix/issue_c

Escape strings before writing them to the log.