Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
Migrate to winston 3 and Extend winston logger

I want to extend the Winston logger to my custom logger. Where I updated the log method before calling the internal method.

For Winston version 2.4.x I did this.

var winston = require("winston");

var Logger = function(options){
  Logger.super_.apply(this, arguments);
}
util.inherits(Logger, winston.Logger);

Logger.prototype.log = function () {

  //some logic

  Logger.super_.prototype.log.apply(this, args);

};

Now, I am migrating to the Winston version 3.x.x

I migrated the above code as

class Logger extends winston.createLogger {

  constructor(options) {
    super(options);
  }

  log() {

    //some logic

    super.log(args);
  };
}

The above code is able to create an instance of the logger and start logging the logs but it is not calling my log method instead it's only calling the inbuild Winston log method.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda