Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Winston logger colorizer solo funciona con todos: verdadero

¿Alguien puede ayudar a encontrar el problema aquí? Estaba haciendo una clase es6 para este Logger con winston 3.5 y de alguna manera no colorea la consola. Pero cuando paso {all: true} como parámetro, todo el registro se colorea.

 const myFormat = printf(({ level, message, meta }) => { return `${moment().tz('Asia/Kolkata').format('DD-MM-YYYYThh:mm:ssA')}: [${level}]: ${message} ${ meta ? (typeof meta === 'object' ? JSON.stringify(meta) : meta) : '' }`; }); class Logger { transports = [new winston.transports.Console()]; constructor(useAzureBlogTransport, azureContainerUrl, journey) { this.useAzureBlogTransport = useAzureBlogTransport; if (useAzureBlogTransport) { if (!azureContainerUrl || !journey) throw new Error('Cannot initialize logger without azure container url and journey'); this.azureContainerUrl = azureContainerUrl; this.transports.push( new AzureBlobTransport({ containerUrl: this.azureContainerUrl, nameFormat: journey + moment().tz('Asia/Kolkata').format('DD-MM-YYYY') + '.log', }) ); } this.logger = winston.createLogger({ transports: this.transports, format: combine( myFormat, colorize({ colors: { info: 'green', error: 'red', }, }), splat() ), }); this.info = (message, meta) => { this.logger.info({ message, meta }); }; this.error = (message, meta) => { this.logger.error({ message, meta }); }; } }

Aquí está el objeto:

 const logger = new Logger(false); logger.error('SUCCESS', '{"a":"b"}'); logger.info('Failed', '{"a":"b"}');
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!