addSimpleConsoleWithOptions method
Adds a simple console logger with custom formatting options.
The configure callback allows customization of the formatter options.
Example:
builder.addSimpleConsoleWithOptions((options) {
options.singleLine = true;
options.timestampFormat = 'yyyy-MM-dd HH:mm:ss';
options.includeScopes = true;
options.colorBehavior = LoggerColorBehavior.enabled;
});
Implementation
LoggingBuilder addSimpleConsoleWithOptions(
void Function(SimpleConsoleFormatterOptions) configure,
) {
final options = SimpleConsoleFormatterOptions();
configure(options);
final formatter = SimpleConsoleFormatter(options);
services.tryAddIterable(
ServiceDescriptor.singleton<LoggerProvider>(
(sp) => FormattedConsoleLoggerProvider(formatter),
),
);
return this;
}