pino icon indicating copy to clipboard operation
pino copied to clipboard

Change redaction at after logger instantiation

Open AlexZeitler opened this issue 5 years ago • 8 comments

Is it possibly to change the redact settings after logger instantiation (data to be redacted may change while service is running)?

Would it be possible to provide an async function instead? Performance overhead would then depend on the fn implementation (e.g. does it use caching etc.?) and not affect pino performance in general.

AlexZeitler avatar Apr 07 '19 10:04 AlexZeitler

Unfortunately it will as that’s a tight hotpath. Deferring even just for a microtick is going to cause a measureable slowdown. Essentially, we should be writing things out as fast as possible, and depending on an external system for this processing can cause an excessive accumulation of data in memory. As a result, allowing async reduction is going to negate all benefit of using pino in the first place.

mcollina avatar Apr 07 '19 13:04 mcollina

You're right. Would it be possible to modify the redact property itself after logger instantiation?

AlexZeitler avatar Apr 07 '19 18:04 AlexZeitler

That could be added. However it will be changed only on the current logger and its future children. The parent maintains no ties with its children.

mcollina avatar Apr 07 '19 20:04 mcollina

Thanks, I'll play around with this topic for better understanding. Is modification of redaction something you would accept a PR for?

AlexZeitler avatar Apr 08 '19 12:04 AlexZeitler

I think so, yes.

@davidmarkclements @jsumners wdyt?

mcollina avatar Apr 08 '19 12:04 mcollina

I would be fine with it.

jsumners avatar Apr 08 '19 13:04 jsumners

I think... that we could support async redaction as a transport if we go with worker thread transports in v6

davidmarkclements avatar May 27 '19 15:05 davidmarkclements

Hey there, similar question about the base option object that is passed in during logger instantiation. Would you be open to a PR that allows that base log fields to be updated dynamically for a logger instance and/or a child logger instance?

For context, my use case is that we have fields that we'd like to add to all following logs that only appear at a certain point in the lifecycle of a server request (after logger instantiation).

erikwlarsen avatar Dec 11 '19 21:12 erikwlarsen

Closed by #1059 ?

Fdawgs avatar May 28 '23 20:05 Fdawgs

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.

github-actions[bot] avatar Jun 29 '23 00:06 github-actions[bot]