mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
- removed config reloading - removed console replacement - added recording appender - added config validation - changed config format
31 lines
723 B
JavaScript
31 lines
723 B
JavaScript
'use strict';
|
|
|
|
const test = require('tap').test;
|
|
const layouts = require('../../lib/layouts');
|
|
const sandbox = require('sandboxed-module');
|
|
|
|
test('stdout appender', (t) => {
|
|
const output = [];
|
|
|
|
const appender = sandbox.require(
|
|
'../../lib/appenders/stdout',
|
|
{
|
|
globals: {
|
|
process: {
|
|
stdout: {
|
|
write: function (data) {
|
|
output.push(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
).configure({ type: 'stdout', layout: { type: 'messagePassThrough' } }, layouts);
|
|
|
|
appender({ data: ['cheese'] });
|
|
t.plan(2);
|
|
t.equal(output.length, 1, 'There should be one message.');
|
|
t.equal(output[0], 'cheese\n', 'The message should be cheese.');
|
|
t.end();
|
|
});
|