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

78
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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