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
{{ message }}
Repository navigation
console.error/warn causes problem with GCP Cloud logging #53665
Shouldn't the color only be default when the stdout/stderr are TTY? I wonder #53665 is more of a bug of the TTY detection not smart enough
Linking this message from @joyeecheung, @Triskae do you have any comment on the TTY detection? If so, I apologize for prematurely closing this issue, as it seems like a duplicate
TTY detection ? I'm sorry I don't have knowledge about this ?
The only thing I know is that the console.error add characters to our json string, so it's no more a json string and Cloud Logging is no more able to parse the said json ...
I don't know if it as something to do with TTY
Using console.log, solves the issue, since log doesn't seem to add anything to the printed string
The colorization should only happen if your stderr is directed to a terminal. For cloud logging I imagine they would locally pipe the stderr somewhere else (a file or a socket or a pipe) to send the logs over to the server for the users to see in their console (e.g. the browser), in that case the stderr won’t be colorized. Unless GCP tricks Node.js into thinking the stderr is a (pseudo) TTY.
Activity
avivkeller commentedon Jul 1, 2024
Duplicate of #53661
This is the same issue, but in a different context.
avivkeller commentedon Jul 1, 2024
Linking this message from @joyeecheung, @Triskae do you have any comment on the TTY detection? If so, I apologize for prematurely closing this issue, as it seems like a duplicate
Triskae commentedon Jul 2, 2024
TTY detection ? I'm sorry I don't have knowledge about this ?
The only thing I know is that the console.error add characters to our json string, so it's no more a json string and Cloud Logging is no more able to parse the said json ...
I don't know if it as something to do with TTY
Using console.log, solves the issue, since log doesn't seem to add anything to the printed string
avivkeller commentedon Jul 2, 2024
Got it! Thanks. See the linked issue for the discussion on coloring.
joyeecheung commentedon Jul 2, 2024
The colorization should only happen if your stderr is directed to a terminal. For cloud logging I imagine they would locally pipe the stderr somewhere else (a file or a socket or a pipe) to send the logs over to the server for the users to see in their console (e.g. the browser), in that case the stderr won’t be colorized. Unless GCP tricks Node.js into thinking the stderr is a (pseudo) TTY.