Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda