Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

81
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!