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

79
Visualizações
Logging everything - Javascript

I have lots of microservices which I want to log. My goal is creating a npm package that will be installed in each of the services. What I aim for is easy integration for example:

const myLogger = require('mylogger')

//.... Express stuff
myLogger(app) 

What I would like to happen in the npm module is that it will log everything from functions executing to variable assignments. Is there a tool to do it with just wrapping the app? Or do I have to log everything explicitly by writing log.info.. log.warn.. Etc

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is no such capability in Javascript that will automatically log every function being called or every variable being assigned in a module. Only the interpreter itself would know how to do that and it doesn't offer a feature for that.

It would be possible to wrap the Express app and then write specific code in the wrapper to log when specific methods on the Express app were called. You could do that by replacing the Express methods with some sort of proxy stub that logs and then calls the original. But, even then, you'd have to decide which methods and which arguments to those methods you want to log and write code in the wrapper to achieve that.

about 4 years ago · Juan Pablo Isaza 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