mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
docs: improving default example in categories.md
This commit is contained in:
parent
90fdcaacc5
commit
6a6cbdb383
@ -9,11 +9,18 @@ const log4js = require('log4js');
|
||||
log4js.configure({
|
||||
appenders: {
|
||||
out: { type: 'stdout' },
|
||||
app: { type: 'file', filename: 'application.log' }
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: [ 'out' ], level: 'trace' }
|
||||
default: { appenders: [ 'out' ], level: 'trace' },
|
||||
app: { appenders: ['app'], level: 'trace' }
|
||||
}
|
||||
});
|
||||
|
||||
const logger = log4js.getLogger();
|
||||
logger.trace('This will use the default category and go to stdout');
|
||||
const logToFile = log4js.getLogger('app');
|
||||
logToFile.trace('This will go to a file');
|
||||
```
|
||||
|
||||
## Categories inheritance
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user