docs: improving default example in categories.md

This commit is contained in:
rnd-debug 2020-05-03 11:11:27 +02:00
parent 90fdcaacc5
commit 6a6cbdb383

View File

@ -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