configureLogging
mach::AppBuilder::configureLogging
Configures logging.
Description
Section titled “Description”Configures the application’s logging options.
Syntax
Section titled “Syntax”template <typename TConfigure> requires std::invocable<TConfigure, LoggerOptions&>AppBuilder& configureLogging(TConfigure&& configure);Return Value
Section titled “Return Value”A reference to the current AppBuilder instance.
Template Parameters
Section titled “Template Parameters”| Parameter | Description |
|---|---|
TConfigure |
The type of the callable used to configure the logging options. |
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
configure |
A callable that receives the logging options to configure. |
Remarks
Section titled “Remarks”- The configuration callable is invoked immediately and receives LoggerOptions by reference.
- Changes made after App::run() has been called do not take effect.
Thread Safety
Section titled “Thread Safety”This method is not thread-safe and should only be called during application configuration, before the application starts handling requests.
Example
Section titled “Example”builder.configureLogging([](mach::LoggerOptions& options) { options.logLevel = mach::LogLevel::Debug; options.enableColors = false; options.pattern = "[%Y-%m-%d %H:%M:%S] [%^%l%$] %v";});See Also
Section titled “See Also”| Name | Description |
|---|---|
LoggerOptions |
Configures the built-in Mach logger. |