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

logger can emit invalid json in some cases #31

Open
ceejbot opened this issue Dec 16, 2021 · 1 comment
Open

logger can emit invalid json in some cases #31

ceejbot opened this issue Dec 16, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ceejbot
Copy link
Contributor

ceejbot commented Dec 16, 2021

If you log a string variable using the debug formatter, kv-log-macro does not escape the double-quotes properly, resulting in invalid json in the log line. E.g.,

let foo = "bar";
log::info!("log some data; foo={:?}",  foo);

produces:
{"level":"info","pid":1837,"message":"log some data; foo="bar"","target":"geolocality::endpoints::foo","hostname":"example.com","time":"2021-12-15T06:41:28.325Z"}

The individual fix is to log displayable types with the display formatter, but we should see why kv-log-macro isn't escaping strings correctly and act somehow. update? file bug? switch loggers? other?

@ceejbot ceejbot added the bug Something isn't working label Dec 16, 2021
@chrisdickinson
Copy link
Contributor

I think the fix would be in here: https://github.com/eaze/preroll/blob/latest/src/logging/json.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants