File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1
1
# @elastic/ecs-pino-format Changelog
2
2
3
+ ## Unreleased
4
+
5
+ - The ecs-logging spec was [ updated to allow "message" to be
6
+ optional] ( https://github.com/elastic/ecs-logging/pull/55 ) . This allows the
7
+ [ change to fallback to an empty string message] ( https://github.com/elastic/ecs-logging-nodejs/pull/64 )
8
+ to be removed -- which is cleaner and fixes a
9
+ [ side-effect bug] ( https://github.com/elastic/ecs-logging-nodejs/issues/73 )
10
+ where usage of pino's ` prettyPrint: true ` was broken.
11
+
3
12
## v1.1.0
4
13
5
14
- Fix a "TypeError: Cannot read property 'host' of undefined" crash when using
6
15
` convertReqRes: true ` and logging a ` req ` field that is not an HTTP request
7
16
object.
17
+ ([ #71 ] ( https://github.com/elastic/ecs-logging-nodejs/pull/71 ) )
8
18
9
19
- Set the "message" to the empty string for logger calls that provide no
10
20
message, e.g. ` log.info({foo: 'bar'}) ` . In this case pino will not add a
11
21
message field, which breaks ecs-logging spec.
22
+ ([ #64 ] ( https://github.com/elastic/ecs-logging-nodejs/pull/64 ) )
12
23
13
24
- Fix handling when the [ ` base ` ] ( https://getpino.io/#/docs/api?id=base-object )
14
25
option is used to the pino constructor.
26
+ ([ #63 ] ( https://github.com/elastic/ecs-logging-nodejs/pull/63 ) )
15
27
16
28
Before this change, using, for example:
17
29
const log = pino({base: {foo: "bar"}, ...ecsFormat()})
Original file line number Diff line number Diff line change @@ -213,12 +213,6 @@ function createEcsPinoOptions (opts) {
213
213
}
214
214
}
215
215
216
- // If no message (https://getpino.io/#/docs/api?id=message-string) is
217
- // given in the log statement, then pino will not emit a message field.
218
- // However, the ecs-logging spec requires a message field, so we set
219
- // a fallback empty string.
220
- ecsObj . message = ''
221
-
222
216
return ecsObj
223
217
}
224
218
}
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ test('ecsPinoFormat cases', suite => {
133
133
}
134
134
} ,
135
135
{
136
- name : 'no message in log call should result in empty string message ' ,
136
+ name : 'no message in log call should be fine ' ,
137
137
pinoOpts : ecsFormat ( ) ,
138
138
loggingFn : ( log ) => {
139
139
log . info ( { foo : 'bar' } )
@@ -143,8 +143,7 @@ test('ecsPinoFormat cases', suite => {
143
143
ecs : { version : ecsVersion } ,
144
144
process : { pid : process . pid } ,
145
145
host : { hostname : os . hostname } ,
146
- foo : 'bar' ,
147
- message : ''
146
+ foo : 'bar'
148
147
}
149
148
}
150
149
]
You can’t perform that action at this time.
0 commit comments