8000 fix(stderr): updated stderr to new appender format · mKoder/log4js-node@9631b62 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9631b62

Browse files
author
Gareth Jones
committed
fix(stderr): updated stderr to new appender format
1 parent 833c5a0 commit 9631b62

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

lib/appenders/stderr.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
'use strict';
22

3-
const layouts = require('../layouts');
4-
53
function stderrAppender(layout, timezoneOffset) {
6-
layout = layout || layouts.colouredLayout;
74
return (loggingEvent) => {
85
process.stderr.write(`${layout(loggingEvent, timezoneOffset)}\n`);
96
};
107
}
118

12-
function configure(config) {
13-
let layout;
9+
function configure(config, layouts) {
10+
let layout = layouts.colouredLayout;
1411
if (config.layout) {
1512
layout = layouts.layout(config.layout.type, config.layout);
1613
}
1714
return stderrAppender(layout, config.timezoneOffset);
1815
}
1916

20-
module.exports.appender = stderrAppender;
2117
module.exports.configure = configure;

lib/appenders/stdout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
function stdoutAppender(layout, timezoneOffset) {
4-
return function (loggingEvent) {
4+
return (loggingEvent) => {
55
process.stdout.write(`${layout(loggingEvent, timezoneOffset)}\n`);
66
};
77
}

test/tap/stderrAppender-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('stderr appender', (t) => {
2020
}
2121
}
2222
}
23-
).appender(layouts.messagePassThroughLayout);
23+
).configure({ type: 'stderr', layout: { type: 'messagePassThrough' } }, layouts);
2424

2525
appender({ data: ['biscuits'] });
2626
t.plan(2);

0 commit comments

Comments
 (0)
0