hapijs / hapi-pino

🌲 Hapi plugin for the Pino logger
MIT License
148 stars 61 forks source link

Hapi pino is not generating logs for the events-onPostStop. #181

Open LeoNaveen10 opened 1 year ago

LeoNaveen10 commented 1 year ago

while hapi-pino is perfectly generating logs for server started but for server stop not generating any logs even though those events are enabled by default. I am attaching hapi-pino registration with server.

 const customLevel =process.env.BUILD_ENV == 'stage' || process.env.BUILD_ENV == 'prod'
        ? 'debug'
        : 'trace';

 await server.register({
      plugin: require('hapi-pino'),
      options: {
        prettyPrint: false,
        logRequestStart: true,
        logRequestComplete: true,
        redact: ['req.headers', 'res.headers'],
        level: customLevel,
      },
    });

logs for server start is as below.

{"level":30,"time":1677652120597,"pid":22096,"hostname":","created":1677652120297,"started":1677652120587,"host":"","port":1111,"protocol":"http","id":"***:22096:lepar8q1","uri":"http://******:1111","address":"::","msg":"server started"}

mcollina commented 1 year ago

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.