Skip to content

tracing-journald: message formatter#3474

Open
jhruzova wants to merge 4 commits intotokio-rs:mainfrom
jhruzova:main
Open

tracing-journald: message formatter#3474
jhruzova wants to merge 4 commits intotokio-rs:mainfrom
jhruzova:main

Conversation

@jhruzova
Copy link

Motivation

Enable custom formatting of log messages with access to both message content and metadata before sending them to journald, while maintaining structured field support.

Changes

  • Introduced a MessageFormatter trait with a method:
    fn format_message(&self, message: &str, metadata: &Metadata<'_>) -> String;
  • Added support in Layer to set a custom formatter using:
    pub fn with_message_formatter(self, formatter: impl MessageFormatter + 'static) -> Self;
  • Updated EventVisitor to apply the custom formatter to the message field if provided.

@jhruzova jhruzova requested review from a team, hawkw and hds as code owners February 10, 2026 12:15
@jhruzova jhruzova changed the title Message formatter for journald tracing-journald: message formatter Feb 10, 2026
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

Successfully merging this pull request may close these issues.

1 participant