Skip to content

Commit

Permalink
Merge branch 'master' into trentm/context-propagation-only
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm authored Nov 2, 2021
2 parents cc8dca7 + b869458 commit 55c95a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ This fixes an issue with context binding of EventEmitters, where
`removeListener` would fail to actually remove if the same handler function was
added to multiple events.
* Fix pino's deprecation warning when using a custom logger with pino@6 ({issues}2332[#2332])
[[release-notes-3.23.0]]
==== 3.23.0 2021/10/25
Expand Down
6 changes: 6 additions & 0 deletions lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

var ecsFormat = require('@elastic/ecs-pino-format')
var pino = require('pino')
var semver = require('semver')

const DEFAULT_LOG_LEVEL = 'info'

Expand Down Expand Up @@ -116,6 +117,11 @@ function createLogger (levelName, customLogger) {
// Is this a pino logger? If so, it supports the API the agent requires and
// can be used directly. We must add our custom serializers.
if (Symbol.for('pino.serializers') in customLogger) {
// Pino added `options` second arg to `logger.child` in 6.12.0.
if (semver.gte(customLogger.version, '6.12.0')) {
return customLogger.child({}, { serializers })
}

return customLogger.child({
serializers: serializers
})
Expand Down

0 comments on commit 55c95a7

Please sign in to comment.