Skip to content
Download

configureLogging

mach::AppBuilder::configureLogging

Configures logging.

Configures the application’s logging options.

template <typename TConfigure>
requires std::invocable<TConfigure, LoggerOptions&>
AppBuilder& configureLogging(TConfigure&& configure);

A reference to the current AppBuilder instance.

Parameter Description
TConfigure The type of the callable used to configure the logging options.
Parameter Description
configure A callable that receives the logging options to configure.
  • The configuration callable is invoked immediately and receives LoggerOptions by reference.
  • Changes made after App::run() has been called do not take effect.

This method is not thread-safe and should only be called during application configuration, before the application starts handling requests.

builder.configureLogging([](mach::LoggerOptions& options) {
options.logLevel = mach::LogLevel::Debug;
options.enableColors = false;
options.pattern = "[%Y-%m-%d %H:%M:%S] [%^%l%$] %v";
});
Name Description
LoggerOptions Configures the built-in Mach logger.