Class LoggerConfig
Defined in File logger_config.h
Class Documentation
-
class LoggerConfig
LoggerConfig defines various configurable aspects of a Logger’s behavior. This class should not be used directly to configure a Logger’s behavior, instead a ScopeConfigurator should be used to compute the desired LoggerConfig which can then be used to configure a Logger.
Public Functions
-
bool operator==(const LoggerConfig &other) const noexcept
-
bool IsEnabled() const noexcept
Returns if the Logger is enabled or disabled. Loggers are enabled by default.
- Returns:
a boolean indicating if the Logger is enabled. Defaults to true.
-
opentelemetry::logs::Severity GetMinimumSeverity() const noexcept
Returns the configured minimum severity for the Logger.
- Returns:
the minimum severity. Defaults to Severity::kInvalid.
-
bool IsTraceBased() const noexcept
Returns if trace-based filtering is enabled for the Logger.
- Returns:
a boolean indicating if trace-based filtering is enabled. Defaults to false.
Public Static Functions
-
static LoggerConfig Create(bool enabled, opentelemetry::logs::Severity minimum_severity, bool trace_based) noexcept
Returns a LoggerConfig with the provided settings.
- Parameters:
enabled – if false, the Logger behaves like a no-op logger.
minimum_severity – the minimum severity required for filtering.
trace_based – if true, trace-based filtering is enabled.
- Returns:
a LoggerConfig with the provided settings.
-
static LoggerConfig Enabled()
Returns a LoggerConfig that represents an enabled Logger.
- Returns:
a static constant LoggerConfig that represents an enabled logger.
-
static LoggerConfig Disabled()
Returns a LoggerConfig that represents a disabled Logger. A disabled logger behaves like a no-op logger.
- Returns:
a static constant LoggerConfig that represents a disabled logger.
-
static LoggerConfig Default()
Returns a LoggerConfig that represents a Logger configured with the default behavior. The default behavior is guided by the OpenTelemetry specification.
- Returns:
a static constant LoggerConfig that represents a logger configured with default behavior.
-
bool operator==(const LoggerConfig &other) const noexcept