Logger utils and middleware build upon winstonjs, severity levels is syslog based.
$ npm test
process.env.LOG_FORMAT
e.g pretty to generate human readable logsprocess.env.LOG_LEVEL
e.g debug, default isinfo
ordebug
based on yourNODE_ENV
process.env.LOG_SUPPRESS
with valuetrue
to suppress all logs (when you run some test, maybe)
-
logger object is available globally, and it provide syslog levels
{ emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }
. -
middleware
-
XRequestId()
express
req.id
will be read fromreq.headers['x-request-id']
and concatenated with the package name or new one is created for this request, and it will be available in request response headers asx-request-id
.var XRequestId = require('exwml').XRequestId; var app = express(); app.use(XRequestId());
-
expressWinston()
log all details about any incoming request such as headers, params, responseTime ...
var expressWinston = require('exwml').expressWinston; var app = express(); app.use(expressWinston());
-
- meta object keys (case insensitive)
['password', 'pwd', 'auth', 'authorization', 'cfg']
will be REDACTED