Type Alias LogFormatter

Source
pub type LogFormatter<TS, L> = fn(timestamp: TS, level: &L, target: &str, message: &str) -> String;
Expand description

Defines the function signature that can be passed to the logging system to customize how log messages are formatted.

ยงParams

  • TS: The type of the timestamp (e.g., block number, system time, or any type implementing Debug).
  • L: The type representing log level (e.g., LogLevel).
  • target (&str): the logging target, typically the module or subsystem.
  • message (&str): the main log message.

It returns a String containing the fully formatted log line.

This allows the caller to completely customize the log output format, e.g., changing the order, adding emojis, colors, or any additional context.