Log into JSON: it's rich, structured and you can parse messages even if the structure changes somewhat. Log to the standard output and let the execution environment pick it up.

It is generally discouraged to import the same 3rd party library in many different locations. A good practice to hide the dependency behind a local proxy, so you can change the implementation as you see fit.

The same is valid for logging. Pick a library - if you even need a library at all - and set it up behind your facade, so your modules keep importing @you/logger.

Try to use two log levels: debug and info. Debug is for developers only, do not enable it in production. Info is for analytics and auditing.

Last updated