8000 Update redisAppender-test.js · mKoder/log4js-node@317d68e · GitHub
[go: up one dir, main page]

Skip to content

Commit 317d68e

Browse files
authored
Update redisAppender-test.js
1 parent 15583cb commit 317d68e

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

test/tap/redisAppender-test.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ function setupLogging(category, options) {
88
const msgs = [];
99

1010
const redisHost = {
11+
type: options.type,
1112
host: options.host,
1213
port: options.port,
1314
pass: options.pass,
14-
channel: options.channel
15+
channel: options.channel,
16+
category: options.category,
17+
layout: options.layout
1518
};
1619

1720
const fakeRedis = {
@@ -94,7 +97,13 @@ test('log4js redisAppender', (batch) => {
9497
host: '127.0.0.1',
9598
port: 6739,
9699
pass: '',
97-
channel: 'log'
100+
channel: 'log',
101+
type: 'redis',
102+
category: 'redis',
103+
layout: {
104+
type: 'pattern',
105+
pattern: '%d{yyyy-MM-dd hh:mm:ss:SSS}#%p#%m'
106+
}
98107
});
99108

100109
t.test('redis credentials should match', (assert) => {
@@ -112,7 +121,13 @@ test('log4js redisAppender', (batch) => {
112121
host: '127.0.0.1',
113122
port: 6739,
114123
pass: '',
115-
channel: 'log'
124+
channel: 'log',
125+
type: 'redis',
126+
category: 'redis',
127+
layout: {
128+
type: 'pattern',
129+
pattern: '%d{yyyy-MM-dd hh:mm:ss:SSS}#%p#%m'
130+
}
116131
});
117132

118133
setup.logger.info('Log event #1');
@@ -125,10 +140,10 @@ test('log4js redisAppender', (batch) => {
125140
batch.test('config with layout', (t) => {
126141
const result = setupLogging('config with layout', {
127142
layout: {
128-
type: 'tester'
143+
type: 'redis'
129144
}
130145
});
131-
t.equal(result.layouts.type, 'tester', 'should configure layout');
146+
t.equal(result.layouts.type, 'redis', 'should configure layout');
132147
t.end();
133148
});
134149

@@ -137,7 +152,13 @@ test('log4js redisAppender', (batch) => {
137152
host: '127.0.0.1',
138153
port: 6739,
139154
pass: '',
140-
channel: 'log'
155+
channel: 'log',
156+
type: 'redis',
157+
category: 'redis',
158+
layout: {
159+
type: 'pattern',
160+
pattern: '%d{yyyy-MM-dd hh:mm:ss:SSS}#%p#%m'
161+
}
141162
});
142163
setTimeout(() => {
143164
setup.logger.info('Log event #1');

0 commit comments

Comments
 (0)
0