pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.27k stars 150 forks source link

Backslashes escaped in object values #378

Closed ntzm closed 1 year ago

ntzm commented 2 years ago

I am logging polylines which include the character \. When I try to log them, it escapes the backslash as it's JSON encoding the value. e.g.

pino.info({ polyline: '\\' })

outputs polyline: "\\", when it would be more correct to output polyline: "\"

An extra \ can mess up the shape of the polyline e.g.

{o_uIzhvS?P_@VcAr@u@j@[\\QDKAUQISb@sDAe@Ai@G[GCWC_@KSIWSAQ
{o_uIzhvS?P_@VcAr@u@j@[\QDKAUQISb@sDAe@Ai@G[GCWC_@KSIWSAQ

Thanks :)

mcollina commented 2 years ago

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.