Fix escaping in logger, add test