escape and unescape logs