Conversation
Signed-off-by: Keming <kemingy94@gmail.com>
Signed-off-by: Keming <kemingy94@gmail.com>
|
Thank you! I'll review this patch by the end of next week. Feel free to ping me if I meet the estimate. |
Signed-off-by: tison <wander4096@gmail.com>
|
AFAIK, there is no official spec for logfmt. The article is the source. Grafana Loki is using https://github.com/go-logfmt/logfmt, which could be seen as a successor of https://github.com/kr/logfmt.
Also found some interesting discussions in the Python implementation: josheppinette/python-logfmter#15 |
Signed-off-by: Keming <kemingy94@gmail.com>
|
Yeah. I think that if the key/value has |
| if key.contains([' ', '=', '"']) { | ||
| // omit keys contain special chars | ||
| return; | ||
| } |
There was a problem hiding this comment.
Maybe return an error as go logfmt does. But it would require diagnostic visitor's visit failable and I'll leave it for a follow-up.
There was a problem hiding this comment.
Will the key contain special chars? AFAIK, it's set from the log with feature kv like:
info!(key = "something else"; "here is the msg");It's guaranteed by the compiler.
There was a problem hiding this comment.
This is possible and how go logfmt implements it.
It's guaranteed by the compiler.
The compiler guarantees it's an expr; nothing more. https://github.com/rust-lang/log/blob/71d533f9bb35fcbb75979ad4fe9743b80c6a8ba4/src/macros.rs#L445-L454
There was a problem hiding this comment.
TIL. Thanks for the information.
tisonkun
left a comment
There was a problem hiding this comment.
LGTM. Pending for merging.
|
Thanks for your contribution! |
This closes #98.