How use a “commander” CLI flag to set the the “winston” logging level in a node library
Given this sample commander application:
Given this sample commander application:
in order to get log as
Is it possible to define a unique request Id that is included in each log statement without handing the logger to each method/function call?
First of all, I’m new to es6
and jest
.
I just implemented Winston Logging and it works as expected but i came accross a few issues which i cant find answer for.
We’d like to use Winston for our logging in Node.js. But, we can’t figure out how to have two log files: one for just errors, and one for everything else.
I want to add timestamp to logs. What is the best way to achieve this?
I have several modules – let’s say server.js, module1.js,…,moduleN.js.
For every logger statement with any level, I need to display the file name from where the log statement executed, below is the illustration I given below:
I have defined custom levels for my application .They are as follows.