userver: userver/ugrpc/client/middlewares/log/component.hpp Source File
Loading...
Searching...
No Matches
component.hpp
1#pragma once
2
3/// @file userver/ugrpc/client/middleware/log/component.hpp
4/// @brief @copybrief ugrpc::client::middlewares::log::Component
5
6#include <userver/ugrpc/client/middlewares/base.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10/// Client logging middleware
11namespace ugrpc::client::middlewares::log {
12
13// clang-format off
14
15/// @ingroup userver_components
16///
17/// @brief Component for gRPC client logging
18///
19/// ## Static options:
20/// Name | Description | Default value
21/// ---- | ----------- | -------------
22/// log-level | log level for msg logging | debug
23/// msg-size-log-limit | max message size to log, the rest will be truncated | 512
24
25// clang-format on
26
27class Component final : public MiddlewareComponentBase {
28 public:
29 /// @ingroup userver_component_names
30 /// @brief The default name of ugrpc::client::middlewares::log::Component
31 static constexpr std::string_view kName = "grpc-client-logging";
32
33 Component(const components::ComponentConfig& config,
34 const components::ComponentContext& context);
35
36 std::shared_ptr<const MiddlewareFactoryBase> GetMiddlewareFactory() override;
37
38 static yaml_config::Schema GetStaticConfigSchema();
39
40 private:
41 std::size_t max_size_;
42 logging::Level log_level_;
43};
44
45} // namespace ugrpc::client::middlewares::log
46
47USERVER_NAMESPACE_END