userver: components::LoggingConfigurator Class Reference
Loading...
Searching...
No Matches
components::LoggingConfigurator Class Referencefinal

#include <userver/components/logging_configurator.hpp>

Detailed Description

Helper component to configure logging.

The functionality is not in Trace or Logger components because that introduces circular dependency between Logger and DynamicConfig.

LoggingConfigurator Dynamic config

Static options of components::LoggingConfigurator :

Name Description Default value
limited-logging-enable Set to true to make LOG_LIMITED drop repeated logs. –
limited-logging-interval Utils::StringToDuration suitable duration string to group repeated logs into one message. –

Options inherited from components::ComponentBase :

Name Description Default value
load-enabled Set to false to disable loading of the component. true

Config example:

# yaml
logging-configurator:
limited-logging-enable: true
limited-logging-interval: 1s

Definition at line 46 of file logging_configurator.hpp.

Inheritance diagram for components::LoggingConfigurator:

Public Member Functions

 LoggingConfigurator (const ComponentConfig &config, const ComponentContext &context)
void SetRestrictions (logging::TelemetryConfig restrictions)
virtual ComponentHealth GetComponentHealth () const
virtual void OnLoadingCancelled ()
virtual void OnAllComponentsLoaded ()
virtual void OnGracefulShutdown (engine::Deadline)
virtual void OnAllComponentsAreStopping ()

Static Public Member Functions

static yaml_config::Schema GetStaticConfigSchema ()

Static Public Attributes

static constexpr std::string_view kName = "logging-configurator"
 The default name of components::LoggingConfigurator component.

Member Function Documentation

◆ GetComponentHealth()

virtual ComponentHealth components::RawComponentBase::GetComponentHealth ( ) const
inlinevirtualinherited

◆ OnAllComponentsAreStopping()

virtual void components::RawComponentBase::OnAllComponentsAreStopping ( )
inlinevirtualinherited

◆ OnAllComponentsLoaded()

virtual void components::RawComponentBase::OnAllComponentsLoaded ( )
inlinevirtualinherited

◆ OnGracefulShutdown()

virtual void components::RawComponentBase::OnGracefulShutdown ( engine::Deadline )
virtualinherited

◆ OnLoadingCancelled()

virtual void components::RawComponentBase::OnLoadingCancelled ( )
inlinevirtualinherited

Reimplemented in components::ComponentBase.

Definition at line 59 of file raw_component_base.hpp.

◆ SetRestrictions()

void components::LoggingConfigurator::SetRestrictions ( logging::TelemetryConfig restrictions)

Replaces the process's single external policy and applies the stricter settings from it and USERVER_TELEMETRY_SETTINGS. An empty policy removes external restrictions. Calls are synchronized with dynamic config updates. The caller must stop its subscriptions and clear its policy before this component is destroyed.

Exceptions
std::runtime_errorfor invalid sampling rates, without changing the policy.

The documentation for this class was generated from the following file: