winsoroaks
winsoroaks10mo ago

recommended logger for convex functions?

hi team, i've been using tslog as my logger for my front end stuff. apparently when i try to import it to my convex functions, im getting weird stuff, sth like some byte arrays?
'\x1B[37m2024-03-10 06:36:32.902\x1B[39m\x1B[0m\x1B[0m\t\x1B[34m\x1B[1mINFO\x1B[22m\x1B[39m\x1B[0m\x1B[0m\t[\x1B[37m/user/client.js:1280\x1B[39m\x1B[0m\x1B[0m\x1B[1m\x1B[37m\x1B[39m\x1B[22m\x1B[0m\x1B[0m]\tUpdating ...'
'\x1B[37m2024-03-10 06:36:32.902\x1B[39m\x1B[0m\x1B[0m\t\x1B[34m\x1B[1mINFO\x1B[22m\x1B[39m\x1B[0m\x1B[0m\t[\x1B[37m/user/client.js:1280\x1B[39m\x1B[0m\x1B[0m\x1B[1m\x1B[37m\x1B[39m\x1B[22m\x1B[0m\x1B[0m]\tUpdating ...'
i think i can go with console.log, just wondering if there's some known limitation with my current approach. thanks!
1 Reply
lee
lee10mo ago
Those look like ansi escape codes https://en.wikipedia.org/wiki/ANSI_escape_code?wprov=sfti1 which are used to change colors when printing to a terminal. Convex's logging doesn't parse the codes so they get printed out like this. I'm not familiar with tslog but according to its docs you could try new Logger({ type: "json" });
ANSI escape code
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as command...

Did you find this page helpful?