@@ -8,10 +8,13 @@ function setupLogging(category, options) {
8
8
const msgs = [ ] ;
9
9
10
10
const redisHost = {
11
+ type : options . type ,
11
12
host : options . host ,
12
13
port : options . port ,
13
14
pass : options . pass ,
14
- channel : options . channel
15
+ channel : options . channel ,
16
+ category : options . category ,
17
+ layout : options . layout
15
18
} ;
16
19
17
20
const fakeRedis = {
@@ -94,7 +97,13 @@ test('log4js redisAppender', (batch) => {
94
97
host : '127.0.0.1' ,
95
98
port : 6739 ,
96
99
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
+ }
98
107
} ) ;
99
108
100
109
t . test ( 'redis credentials should match' , ( assert ) => {
@@ -112,7 +121,13 @@ test('log4js redisAppender', (batch) => {
112
121
host : '127.0.0.1' ,
113
122
port : 6739 ,
114
123
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
+ }
116
131
} ) ;
117
132
118
133
setup . logger . info ( 'Log event #1' ) ;
@@ -125,10 +140,10 @@ test('log4js redisAppender', (batch) => {
125
140
batch . test ( 'config with layout' , ( t ) => {
126
141
const result = setupLogging ( 'config with layout' , {
127
142
layout : {
128
- type : 'tester '
143
+ type : 'redis '
129
144
}
130
145
} ) ;
131
- t . equal ( result . layouts . type , 'tester ' , 'should configure layout' ) ;
146
+ t . equal ( result . layouts . type , 'redis ' , 'should configure layout' ) ;
132
147
t . end ( ) ;
133
148
} ) ;
134
149
@@ -137,7 +152,13 @@ test('log4js redisAppender', (batch) => {
137
152
host : '127.0.0.1' ,
138
153
port : 6739 ,
139
154
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
+ }
141
162
} ) ;
142
163
setTimeout ( ( ) => {
143
164
setup . logger . info ( 'Log event #1' ) ;
0 commit comments