Skip to content

Commit 48195db

Browse files
authored
docs: minor tweak to pino-http example (#172)
This tries to better mimic pino-http's express usage example https://github.com/pinojs/pino-http#use-as-express-middleware and points to a user-provided gist configuring pino to work past this 'req' field limitation.
1 parent fbea3e4 commit 48195db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/ecs-pino-format/examples/express-with-pino-http.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// This shows how one could use @elastic/ecs-pino-format with Express and
2121
// the https://github.com/pinojs/pino-http middleware maintained by the Pino
2222
// team.
23-
// TODO: doc the log.child({req}) limitation
23+
// TODO: doc the log.child({req}) limitation. See https://github.com/elastic/ecs-logging-nodejs/issues/102 and https://gist.github.com/gkampitakis/b36819f38f8886598c20ed1af7245e3a
2424
// TODO: doc pino-http's 'req.id' and ECS translation to 'event.id'
2525

2626
const { ecsFormat } = require('../') // @elastic/ecs-pino-format
@@ -37,7 +37,7 @@ app.use(pinoHttp({ logger: log }))
3737
app.get('/', function (req, res, next) {
3838
res.setHeader('Foo', 'Bar')
3939
res.end('hi')
40-
res.log.info({ req, res }, 'hi there')
40+
req.log.info('in app.get / handler')
4141
})
4242
app.get('/error', function (req, res, next) {
4343
return next(new Error('boom'))

0 commit comments

Comments
 (0)