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

146
Views
Winston logger colorizer only works with all : true

Can someone help to find the issue here. I was making a es6 class for this Logger with winston 3.5 and somehow it does not colorize the console. But when I pass {all: true} as a parameter, the whole log gets colorized.

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 });
    };
  }
}

Here is the object:

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!