diff options
author | iddqd <iddqd@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
commit | 07fce9c5f7771600d0b3d70e1f88fd8a7e164d85 (patch) | |
tree | e4aa4750fbb864d70f8c06cf03d2750e979ea3bf /library/cpp/logger/init_context | |
parent | af42068bf6cd93c976b80dd0388fa48cdf65da11 (diff) | |
download | ydb-07fce9c5f7771600d0b3d70e1f88fd8a7e164d85.tar.gz |
Restoring authorship annotation for <iddqd@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/logger/init_context')
-rw-r--r-- | library/cpp/logger/init_context/README.md | 10 | ||||
-rw-r--r-- | library/cpp/logger/init_context/config.cpp | 52 | ||||
-rw-r--r-- | library/cpp/logger/init_context/config.h | 28 | ||||
-rw-r--r-- | library/cpp/logger/init_context/ya.make | 40 | ||||
-rw-r--r-- | library/cpp/logger/init_context/yconf.cpp | 36 | ||||
-rw-r--r-- | library/cpp/logger/init_context/yconf.h | 26 |
6 files changed, 96 insertions, 96 deletions
diff --git a/library/cpp/logger/init_context/README.md b/library/cpp/logger/init_context/README.md index 93564e4890..bc0103a2f6 100644 --- a/library/cpp/logger/init_context/README.md +++ b/library/cpp/logger/init_context/README.md @@ -1,5 +1,5 @@ -Эта библиотека содержит две раплизации InitContext для TLogBackendCreator. - -TLogBackendCreatorInitContextYConf работает с YandexConfig (library/cpp/yconf). - -TLogBackendCreatorInitContextConfig работает с NConfig::TConfig (library/cpp/config). +Эта библиотека содержит две раплизации InitContext для TLogBackendCreator. + +TLogBackendCreatorInitContextYConf работает с YandexConfig (library/cpp/yconf). + +TLogBackendCreatorInitContextConfig работает с NConfig::TConfig (library/cpp/config). diff --git a/library/cpp/logger/init_context/config.cpp b/library/cpp/logger/init_context/config.cpp index 30efa13333..2fe503fbc8 100644 --- a/library/cpp/logger/init_context/config.cpp +++ b/library/cpp/logger/init_context/config.cpp @@ -1,26 +1,26 @@ -#include "config.h" - -TLogBackendCreatorInitContextConfig::TLogBackendCreatorInitContextConfig(const NConfig::TConfig& config) - : Config(config) -{} - -bool TLogBackendCreatorInitContextConfig::GetValue(TStringBuf name, TString& var) const { - if (Config.Has(name)) { - var = Config[name].Get<TString>(); - return true; - } - return false; -} - -TVector<THolder<ILogBackendCreator::IInitContext>> TLogBackendCreatorInitContextConfig::GetChildren(TStringBuf name) const { - TVector<THolder<IInitContext>> result; - const NConfig::TConfig& child = Config[name]; - if (child.IsA<NConfig::TArray>()) { - for (const auto& i: child.Get<NConfig::TArray>()) { - result.emplace_back(MakeHolder<TLogBackendCreatorInitContextConfig>(i)); - } - } else if (!child.IsNull()) { - result.emplace_back(MakeHolder<TLogBackendCreatorInitContextConfig>(child)); - } - return result; -} +#include "config.h" + +TLogBackendCreatorInitContextConfig::TLogBackendCreatorInitContextConfig(const NConfig::TConfig& config) + : Config(config) +{} + +bool TLogBackendCreatorInitContextConfig::GetValue(TStringBuf name, TString& var) const { + if (Config.Has(name)) { + var = Config[name].Get<TString>(); + return true; + } + return false; +} + +TVector<THolder<ILogBackendCreator::IInitContext>> TLogBackendCreatorInitContextConfig::GetChildren(TStringBuf name) const { + TVector<THolder<IInitContext>> result; + const NConfig::TConfig& child = Config[name]; + if (child.IsA<NConfig::TArray>()) { + for (const auto& i: child.Get<NConfig::TArray>()) { + result.emplace_back(MakeHolder<TLogBackendCreatorInitContextConfig>(i)); + } + } else if (!child.IsNull()) { + result.emplace_back(MakeHolder<TLogBackendCreatorInitContextConfig>(child)); + } + return result; +} diff --git a/library/cpp/logger/init_context/config.h b/library/cpp/logger/init_context/config.h index 8227d13176..579deeb9e4 100644 --- a/library/cpp/logger/init_context/config.h +++ b/library/cpp/logger/init_context/config.h @@ -1,14 +1,14 @@ -#pragma once - -#include <library/cpp/logger/backend_creator.h> -#include <library/cpp/config/config.h> - -class TLogBackendCreatorInitContextConfig : public ILogBackendCreator::IInitContext { -public: - TLogBackendCreatorInitContextConfig(const NConfig::TConfig& config); - virtual bool GetValue(TStringBuf name, TString& var) const override; - virtual TVector<THolder<IInitContext>> GetChildren(TStringBuf name) const override; - -private: - const NConfig::TConfig& Config; -}; +#pragma once + +#include <library/cpp/logger/backend_creator.h> +#include <library/cpp/config/config.h> + +class TLogBackendCreatorInitContextConfig : public ILogBackendCreator::IInitContext { +public: + TLogBackendCreatorInitContextConfig(const NConfig::TConfig& config); + virtual bool GetValue(TStringBuf name, TString& var) const override; + virtual TVector<THolder<IInitContext>> GetChildren(TStringBuf name) const override; + +private: + const NConfig::TConfig& Config; +}; diff --git a/library/cpp/logger/init_context/ya.make b/library/cpp/logger/init_context/ya.make index 9572a34c60..450a3e4fe7 100644 --- a/library/cpp/logger/init_context/ya.make +++ b/library/cpp/logger/init_context/ya.make @@ -1,20 +1,20 @@ -OWNER( - pg - mvel - g:util - g:base -) - -LIBRARY() - -PEERDIR( - library/cpp/logger - library/cpp/config - library/cpp/yconf -) -SRCS( - config.cpp - yconf.cpp -) - -END() +OWNER( + pg + mvel + g:util + g:base +) + +LIBRARY() + +PEERDIR( + library/cpp/logger + library/cpp/config + library/cpp/yconf +) +SRCS( + config.cpp + yconf.cpp +) + +END() diff --git a/library/cpp/logger/init_context/yconf.cpp b/library/cpp/logger/init_context/yconf.cpp index c7da1d607c..5a7a7d2500 100644 --- a/library/cpp/logger/init_context/yconf.cpp +++ b/library/cpp/logger/init_context/yconf.cpp @@ -1,18 +1,18 @@ -#include "yconf.h" - -TLogBackendCreatorInitContextYConf::TLogBackendCreatorInitContextYConf(const TYandexConfig::Section& section) - : Section(section) -{} - -bool TLogBackendCreatorInitContextYConf::GetValue(TStringBuf name, TString& var) const { - return Section.GetDirectives().GetValue(name, var); -} - -TVector<THolder<ILogBackendCreator::IInitContext>> TLogBackendCreatorInitContextYConf::GetChildren(TStringBuf name) const { - TVector<THolder<IInitContext>> result; - auto children = Section.GetAllChildren(); - for (auto range = children.equal_range(TCiString(name)); range.first != range.second; ++range.first) { - result.emplace_back(MakeHolder<TLogBackendCreatorInitContextYConf>(*range.first->second)); - } - return result; -} +#include "yconf.h" + +TLogBackendCreatorInitContextYConf::TLogBackendCreatorInitContextYConf(const TYandexConfig::Section& section) + : Section(section) +{} + +bool TLogBackendCreatorInitContextYConf::GetValue(TStringBuf name, TString& var) const { + return Section.GetDirectives().GetValue(name, var); +} + +TVector<THolder<ILogBackendCreator::IInitContext>> TLogBackendCreatorInitContextYConf::GetChildren(TStringBuf name) const { + TVector<THolder<IInitContext>> result; + auto children = Section.GetAllChildren(); + for (auto range = children.equal_range(TCiString(name)); range.first != range.second; ++range.first) { + result.emplace_back(MakeHolder<TLogBackendCreatorInitContextYConf>(*range.first->second)); + } + return result; +} diff --git a/library/cpp/logger/init_context/yconf.h b/library/cpp/logger/init_context/yconf.h index b1867d271d..574cb617ef 100644 --- a/library/cpp/logger/init_context/yconf.h +++ b/library/cpp/logger/init_context/yconf.h @@ -1,13 +1,13 @@ -#pragma once - -#include <library/cpp/logger/backend_creator.h> -#include <library/cpp/yconf/conf.h> - -class TLogBackendCreatorInitContextYConf: public ILogBackendCreator::IInitContext { -public: - TLogBackendCreatorInitContextYConf(const TYandexConfig::Section& section); - virtual bool GetValue(TStringBuf name, TString& var) const override; - virtual TVector<THolder<IInitContext>> GetChildren(TStringBuf name) const override; -private: - const TYandexConfig::Section& Section; -}; +#pragma once + +#include <library/cpp/logger/backend_creator.h> +#include <library/cpp/yconf/conf.h> + +class TLogBackendCreatorInitContextYConf: public ILogBackendCreator::IInitContext { +public: + TLogBackendCreatorInitContextYConf(const TYandexConfig::Section& section); + virtual bool GetValue(TStringBuf name, TString& var) const override; + virtual TVector<THolder<IInitContext>> GetChildren(TStringBuf name) const override; +private: + const TYandexConfig::Section& Section; +}; |