How to use the addLayout function from log4js
Find comprehensive JavaScript log4js.addLayout code examples handpicked from public code repositorys.
GitHub: baetyl/baetyl-function

30 31 32 33 34 35 36 37 38 39
let backupCount = 15; if (hasAttr(mo.config.logger, 'backupCount') && hasAttr(mo.config.logger.backupCount, 'max')) { backupCount = mo.config.logger.backupCount.max; } log4js.addLayout('baetyl', () => logEvent => { const asctime = moment(logEvent.startTime).format('YYYY-MM-DD HH:mm:ss'); const name = logEvent.categoryName; const levelname = logEvent.level.levelStr; const message = logEvent.data;
GitHub: konser80/tools
12 13 14 15 16 17 18 19 20 21
let tracePattern = 'yyyy-MM-dd-hh0000'; if (opts.hourly === false) tracePattern = 'yyyy-MM-dd'; const layout = { type: 'pretty' }; log4js.addLayout('pretty', () => formatLog4JS); log4js.configure({ levels: { SILLY: { value: 2500, colour: 'blue' } },
41 42 43 44 45 46 47 48 49 50
return JSON.stringify(log); } static setLogger(name, level) { addLayout('json', () => { return Logger.layout; }); configure({ appenders: {
+ 3 other calls in file
log4js.getLogger is the most popular function in log4js (529 examples)