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

126
Visualizações
How to do logging in MEAN Stack

which is the best way to enable logging in node , express , mongoose application? I have been using console logging ;but there is no way to turn it on or off during production. is there something as solid as log4j and can be used in production applications

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can use winston.js, https://github.com/winstonjs/winston#logging-levels You can use log levels and specify which level to log in console and which into some logfile

  var logger = new (winston.Logger)({
transports: [
  new (winston.transports.Console)({ level: 'error' }),
  new (winston.transports.File)({
    filename: 'somefile.log',
    level: 'info'
  })
]

});

But there is also log4js https://github.com/nomiddlename/log4js-node

about 4 years ago · Santiago Trujillo Relatório

0

You can install morgan, Use npm install morgan,

After installing it,require it i.e var morgan = require('morgan'); Since you have express installed, You can then do this to enable morgan, app.use(morgan('dev'));

This should work.

about 4 years ago · Santiago Trujillo Relatório
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