log4js-node-extend icon indicating copy to clipboard operation
log4js-node-extend copied to clipboard

How to configuring preffix or suffix of log?

Open hemavidal opened this issue 8 years ago • 1 comments
trafficstars

There is a way to configure where the extended text will be placed in log message?

This:

log4js_extend(log4js, {
  path: __dirname,
  format: "at @name (@file:@line:@column)"
})
log4js.configure({
	appenders: { index: { type: 'file', filename: logpath, maxLogSize: 20480, backups: 10 }, out: { type: 'stdout' } },
	categories: { default: { appenders: ['index', 'out'], level: 'info' } }
})
const logger = log4js.getLogger('index')
logger.info('my info message')

Results in:

[2017-09-22 13:58:31.517] [INFO] index - my info message at methodName (index.js:24:10) And i want to modify to this: [2017-09-22 13:58:31.517] [INFO] index [methodName (index.js:24:10)] - my info message There is a way to do it?

hemavidal avatar Sep 22 '17 17:09 hemavidal

Sorry, it only support appending to tail of the log. https://github.com/ww24/log4js-node-extend/blob/v0.2.1/log4js-extend.js#L11

ww24 avatar Sep 30 '17 15:09 ww24