userver: userver/components/dump_configurator.hpp Source File
Loading...
Searching...
No Matches
dump_configurator.hpp
1#pragma once
2
3#include <string>
4
5#include <userver/components/component_fwd.hpp>
6#include <userver/components/loggable_component_base.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace components {
11
12// clang-format off
13
14/// @ingroup userver_components
15///
16/// @brief Helper component that manages common configuration for userver dumps.
17///
18/// The component must be configured in service config.
19///
20/// ## Static options:
21/// Name | Description | Default value
22/// ---- | ----------- | -------------
23/// dump-root | Components store dumps in subdirectories of this directory | -
24///
25/// ## Config example:
26///
27/// @snippet components/common_component_list_test.cpp Sample dump configurator component config
28
29// clang-format on
30class DumpConfigurator final : public LoggableComponentBase {
31 public:
32 /// @ingroup userver_component_names
33 /// @brief The default name of components::DumpConfigurator component
34 static constexpr std::string_view kName = "dump-configurator";
35
36 DumpConfigurator(const ComponentConfig& config,
37 const ComponentContext& context);
38
39 const std::string& GetDumpRoot() const;
40
41 static yaml_config::Schema GetStaticConfigSchema();
42
43 private:
44 const std::string dump_root_;
45};
46
47template <>
48inline constexpr bool kHasValidate<DumpConfigurator> = true;
49
50} // namespace components
51
52USERVER_NAMESPACE_END