Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

[Feature request] Add fields #70

Closed
hnakamur opened this issue Jul 16, 2016 · 3 comments
Closed

[Feature request] Add fields #70

hnakamur opened this issue Jul 16, 2016 · 3 comments

Comments

@hnakamur
Copy link

First of all, thanks for creating and sharing a wonderful library!

I think a stack trace with an error message is a big help for debugging, but I also want variable values at the stack where the error occurred. I would like to log those values at the higher stack where I received the error.

So how about adding something like NewWithFields or WrapWithFields?

I implemented a proof of concept at Comparing pkg:a2d6902c6d2a2f194eb3fb474981ab7867c81505...hnakamur:add_fields · pkg/errors

Could you tell me what do you think?
Thanks!

@hnakamur
Copy link
Author

I read (Gophercon 2016) Structured Logging and You, in 5 minute and log/log.go at master · aybabtme/log.
Now I think it would be better to use something like github.com/go-kit/kit/log.Context which has ordered key-value pairs.

@davecheney
Copy link
Member

Thank you for raising this feature request. I believe this is a duplicate of #34.

I believe I understand what you are asking for, but as I concluded in issue #34 such a feature could not be added without creating a mechanism for state to be passed via a side channel in the error's context.

I do not disagree that this would not be useful, I'm more partial to this idea, moreso than structured logging, but I have decided to not implement this feature at this time as I am concerned that it would be abused.

@hnakamur
Copy link
Author

I see. I'm sorry for duplicaton.
Thanks for your explanation.

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

No branches or pull requests

2 participants