Skip to content

logger can emit invalid json in some cases #31

@ceejbot

Description

@ceejbot

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions