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

Fields duplicate instead of overriding #46

Open
bqback opened this issue Jun 4, 2024 · 1 comment
Open

Fields duplicate instead of overriding #46

bqback opened this issue Jun 4, 2024 · 1 comment

Comments

@bqback
Copy link

bqback commented Jun 4, 2024

I do something like httplog.LogEntrySetField(ctx, "step", step) and then oplog := httplog.LogEntry(ctx) to get the logger for that layer as the request goes through my app, with step being either "handler", "service" or "storage".

I kinda expected the method to override this field as the key name remains the same, but instead I just get step: "handler" step: "service" step: "storage" in logs.

What am I doing wrong?

Should I use LogEntrySetFields with a copy of the context as argument to "preserve" the original for the next layer? Doesn't seem to work based on a quick test, at least without some voodoo to build a copy from scratch.

@rkgarcia
Copy link

This sounds like an implementation detail, could you provide more code?

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

No branches or pull requests

2 participants