addSystemdConsoleWithOptions method
Adds a systemd console logger with custom formatting options.
The configure callback allows customization of the formatter options.
Example:
builder.addSystemdConsoleWithOptions((options) {
options.timestampFormat = 'timestamp';
options.includeScopes = true;
});
Implementation
LoggingBuilder addSystemdConsoleWithOptions(
void Function(SystemdConsoleFormatterOptions) configure,
) {
final options = SystemdConsoleFormatterOptions();
configure(options);
final formatter = SystemdConsoleFormatter(options);
services.tryAddIterable(
ServiceDescriptor.singleton<LoggerProvider>(
(sp) => FormattedConsoleLoggerProvider(formatter),
),
);
return this;
}