slog
slog copied to clipboard
Add "tag" and "location" fields to JSON logger
The JSON logger has a set of "default" fields that it outputs: https://github.com/slog-rs/json/blob/master/lib.rs#L320.
However, RecordStatic
contains several additional useful fields (tag and location) which are not logged.
I commented on a PR. Basically - for backward compt. reason we can't just modify that function. Users already can add whatever they want manually, and just because more information is avilable, does not necessary mean all users want to log everything all the time.
What do you mean "users can already add whatever they want manually"? This information is captured internally by the logging macros - in many cases those macros will be called from 3rd party code. There's no way for a user to manually add this information back in.
If any changes to the log output are a breaking change, then that seems like a design issue with this crate - perhaps there could be a constructor taking a "version" argument? Or at least some configuration to allow adding more fields?
What do you mean "users can already add whatever they want manually"?
add_key_value
is a public function. There is nothing special about add_default_keys
. Anything that add_default_keys
can do, user can do too, without it. All the code you've added in https://github.com/slog-rs/json/pull/17/files , you can call from the outside and get the behavior of that PR, even if I don't land this PR.
Therefore there's no point is over-complicating things.