Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow copying fields when using WrapCore #1394

Open
adrianlungu opened this issue Dec 11, 2023 · 0 comments
Open

Allow copying fields when using WrapCore #1394

adrianlungu opened this issue Dec 11, 2023 · 0 comments
Assignees

Comments

@adrianlungu
Copy link

Is your feature request related to a problem? Please describe.

https://go.dev/play/p/vlsJxJfxhUL

Any fields added via the config, or via With to the logger before calling zap.WrapCore are not seen at all by the observer via the context.

Describe the solution you'd like

After building a logger with fields using .Build(), allow using zap.WrapCore to be able to split, or replace the core of a logger, but keep the fields that were added via the configuration, i.e.

This could be done either via exposing Context on core, or internally by copying the context from one core to the other, although allowing the developer to choose the scenario that fits him best would be better.

Describe alternatives you've considered

None so far that wouldn't involve heavy refactoring.

Is this a breaking change?

It should not be a breaking change.

Additional context
N/A/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants