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

Is it possible to add extra fields to individual logs? #6

Closed
nickbroon opened this issue Aug 30, 2021 · 2 comments
Closed

Is it possible to add extra fields to individual logs? #6

nickbroon opened this issue Aug 30, 2021 · 2 comments

Comments

@nickbroon
Copy link

systemd_journal_logger::init_with_extra_fields() allows adding extra fields to every log message.

But is there a way to add extra fields to just individual log messages?

Perhaps something like: info!("Hello systemd journal"; "FOO" => "BAR");

@swsnr
Copy link
Owner

swsnr commented Aug 30, 2021

The logger writes structured log data to the journal. That's an unstable feature if the log crate, see the log crate's GitHub for details.

I don't know whether there's syntax support in the log macros already.

For more info please refer to the log crate for more information.

@swsnr swsnr closed this as completed Aug 30, 2021
@nickbroon
Copy link
Author

ah, thanks for the pointer.
I've found rust-lang/log#343 which tracks adding key/value pairs to the log crate macros.

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

No branches or pull requests

2 participants