logtail-js icon indicating copy to clipboard operation
logtail-js copied to clipboard

Context is always the @logtail/pino file instead of the calling function

Open TheSecurityDev opened this issue 1 year ago • 1 comments

Every log message has a "context" object that's supposed to contain info about where the log was called from. But it seems to always be the same value, so it isn't useful information and just wastes space. I'm not sure if there's any way to remove this data either.

Context object:

    {
        "runtime": {
            "column": 25,
            "file": "..\\..\\..\\..\\@[email protected][email protected][email protected]\\node_modules\\@logtail\\pino\\dist\\cjs\\pino.js",
            "function": "buildFunc",
            "line": 61
        },
        "system": {
            "main_file": "C:\\Users\\[PATH TO SOURCE]\\node_modules\\.pnpm\\[email protected]\\node_modules\\thread-stream\\lib\\worker.js",
            "pid": 38904
        }
    }

This is for the @logtail/pino module specifically, but I tried copying it and modifying the stackFrameHint, but I can't seem to get it to do anything other than log the transport file. It might be an issue with how the @logtail/node module gets the stack frame.

TheSecurityDev avatar Sep 21 '24 18:09 TheSecurityDev

Hey @TheSecurityDev,

Thank you for raising this! This definitely shouldn't happen.

I'm forwarding this to the team to get this fixed. We'll keep you up to date here in GitHub.

Thanks again for reporting this.

curusarn avatar Sep 30 '24 09:09 curusarn

Hi @TheSecurityDev,

Thanks again for raising this 🙌

Unfortunately due to how Pino runs the transport code, it's not possible to add relevant context the same way. We've decided to omit the context altogether in Pino.

We've released the new version as v0.5.2 🚀

PetrHeinz avatar Oct 09 '24 14:10 PetrHeinz