klaudiosinani / signale

Highly configurable logging utility
MIT License
8.92k stars 232 forks source link

Doesn't look like expected, at least inside workers threads #121

Open rubenOrtz opened 1 year ago

rubenOrtz commented 1 year ago

Describe the bug When i use a extended class for Signale export default class Logger extends Signale { constructor(config: any, client?: any) { super({ config, logLevel: 'info', types: { startUp: { badge: 'āœ”', color: 'green', label: 'Inicio', logLevel: 'info', }, log: { badge: 'šŸ‘', color: 'white', label: 'Info', logLevel: 'info', } It works fine, when i call the class from a normal file inside my project (for example, the manager, as you see in the image) const logger = new Logger({ displayTimestamp: true, displayDate: true, }); But when i call the exact same Logger, as the manager, but inside a cluster using Node.js worker threads didnt look as good as it looks in the manager (check the image)

To Reproduce Create a worker thread create a file with a extended Signale as above create a logger inside and outside the worker and call both, you will see the difference

Technical Info (please complete the following information)

image

GRVYDEV commented 1 year ago

Yeah Im running into the same issue. Im wondering if it has something to do with https://github.com/nodejs/node/issues/26946

GRVYDEV commented 1 year ago

Looks like its an issue in the underlying color library chalk. See https://github.com/chalk/chalk/issues/327

I was able to fix it by adding

process.env['FORCE_COLOR'] = '3';

At the top of the file where the workers are spawned