Replace log4js by pino as logger:

- Logs to stdout, disabled while testing
- Change log calls signature when needed
- Use development version of camshaft
- Removes unused log cofiguration
- Bind request id to log req/res
- Log req at the begining of the cycle and res at the end
This commit is contained in:
Daniel García Aubert
2020-06-01 19:18:15 +02:00
parent 656bc9344b
commit 163c546236
20 changed files with 398 additions and 363 deletions
+2 -4
View File
@@ -14,7 +14,7 @@ var LZMA = require('lzma').LZMA;
var lzmaWorker = new LZMA();
var redis = require('redis');
var log4js = require('log4js');
const pino = require('pino');
const setICUEnvVariable = require('../../lib/utils/icu-data-env-setter');
// set environment specific variables
@@ -24,9 +24,7 @@ process.env.NODE_ENV = 'test';
setICUEnvVariable();
// don't output logs in test environment to reduce noise
log4js.configure({ appenders: [] });
global.logger = log4js.getLogger();
global.logger = pino({ base: null, level: process.env.NODE_ENV === 'test' ? 'fatal' : 'info' }, pino.destination({ sync: false }));
// Utility function to compress & encode LZMA
function lzmaCompressToBase64 (payload, mode, callback) {