Closed smasilamani-cfins closed 2 years ago
thank you for filing the issue @saachinsiva
the reason you don't see any colors in v9+ anymore is that the lambda handlers now run in a worker thread
. it seems the color library tracer
you are not using has a bug and can't detect color support in worker threads. I just tried chalk
and it seems to have a similar problem. it appears to be a wide spread problem which should probably be fixed.
if you run this code snippet in your handler you will likely see colors:
console.log('\x1b[36m%s\x1b[0m', 'I am cyan')
I'm suggesting to file a bug against the color library not supporting worker threads
. in the interim, if you absolutely need colors, you can use the useInProcess
flag, which unfortunately comes with a bunch of disadvantages compared to worker threads.
Bug Report
We recently migrated the serverless framework to the latest version from v8.8.1 and stared noticing that none of our log statements are printed in color. With versions upto 8.8.1, we used to see info in green, warn in yellow and error in red color. We use the following logging library https://github.com/baryon/tracer
We confirm that this started happening from V9.0.0 to the latest version.
Current Behavior
Console log colors are no more working.
Sample Code
Expected behavior/code
Color console should work as expected.
Environment
serverless
version: 3.22.0serverless-offline
version: 10.0.0node.js
v16OS
: Amazon2 WSLAdditional context/Screenshots
With V8.8.1
With V10.0.0