pinojs / pino

🌲 super fast, all natural json logger
http://getpino.io
MIT License
14.21k stars 875 forks source link

Using nestedKey swallows Error logging. Bug? #872

Closed josh-renton closed 4 years ago

josh-renton commented 4 years ago

Came across this, I think it's a bug. I'd have expected the error logging behaviour to be the same regardless of the nestedKey option.

const pino = require('pino');
const normal = pino({ name: 'normal' });
const nested = pino({ name: 'nested', nestedKey: 'nest' });

const err = new Error('myError');

/*
Good behaviour.
Logs:
    {
        "level":50,
        "time":xxxxx,
        "pid":xxxxx,
        "hostname":"xxxxxx",
        "name":"normal",
        "stack":"Error: myError\n ....",
        "type":"Error",
        "msg":"myError"}
*/
normal.error(err);

/* 
Where are stack, type='error', msg? No reference to the error at all.
Logs:
    {
        "level":50,
        "time":xxxxx,
        "pid":xxxxx,
        "hostname":"xxxxxx",
        "name":"nested"
        "nest":{}
    }
*/
nested.error(err);
mcollina commented 4 years ago

Likely this is a bug! Would you like to send a PR to fix this?

jsumners commented 4 years ago

Duplicate https://github.com/pinojs/pino/issues/771

josh-renton commented 4 years ago

Thanks, I'll check https://github.com/pinojs/pino/issues/771

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.