You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Careful though, if this is solved with just a prefix then an attacker could exploit this to make your terminal do funky things by if they merely control some to-be-logged value (which they usually do).
If this becomes a library feature then imo it should be 1) behind an off-by-default flag (for e.g. libraries) and 2) a special type to wrap unsafe "raw" strings with, that should not be escaped when being printed.
Hi! I'm trying to add syntax highlighting for my SQL queries in logs.
There is a library that does it pretty well:
But when I try to add colorized SQL as slog.Attr, it will print escaped sequence instead:
I believe this is happening because of
strconv.AppendQuote
, which you are using to quote strings here. AppendQuote escapes all the colors sequences.Seems like you're passing "quote=true" everywhere and I cannot disable this behavior using ReplaceAttrs or something like that.
Am I missing something? Is there a way to preserve colors for some attributes? Thanks!
The text was updated successfully, but these errors were encountered: