aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/uninitialized_creator.cpp
diff options
context:
space:
mode:
authoriddqd <iddqd@yandex-team.ru>2022-02-10 16:49:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:46 +0300
commitff241e1daf76d79ed38015cdb76d55eb3a33ac27 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/logger/uninitialized_creator.cpp
parent07fce9c5f7771600d0b3d70e1f88fd8a7e164d85 (diff)
downloadydb-ff241e1daf76d79ed38015cdb76d55eb3a33ac27.tar.gz
Restoring authorship annotation for <iddqd@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/logger/uninitialized_creator.cpp')
-rw-r--r--library/cpp/logger/uninitialized_creator.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/library/cpp/logger/uninitialized_creator.cpp b/library/cpp/logger/uninitialized_creator.cpp
index 5d7528ae23..26dd168529 100644
--- a/library/cpp/logger/uninitialized_creator.cpp
+++ b/library/cpp/logger/uninitialized_creator.cpp
@@ -1,50 +1,50 @@
-#include "uninitialized_creator.h"
-#include "filter_creator.h"
-#include "thread_creator.h"
-#include "file_creator.h"
-#include "null_creator.h"
-#include <util/string/cast.h>
-
-THolder<TLogBackend> TLogBackendCreatorUninitialized::DoCreateLogBackend() const {
- return Slave->CreateLogBackend();
-}
-
-void TLogBackendCreatorUninitialized::InitCustom(const TString& type, ELogPriority priority, bool threaded) {
- if (!type) {
- Slave = MakeHolder<TNullLogBackendCreator>();
- } else if (TFactory::Has(type)) {
- Slave = TFactory::MakeHolder(type);
- } else {
- Slave = MakeHolder<TFileLogBackendCreator>(type);
- }
-
- if (threaded) {
- Slave = MakeHolder<TOwningThreadedLogBackendCreator>(std::move(Slave));
- }
-
- if (priority != LOG_MAX_PRIORITY) {
- Slave = MakeHolder<TFilteredBackendCreator>(std::move(Slave), priority);
- }
-}
-
-bool TLogBackendCreatorUninitialized::Init(const IInitContext& ctx) {
- auto type = ctx.GetOrElse("LoggerType", TString());
- bool threaded = ctx.GetOrElse("Threaded", false);
- ELogPriority priority = LOG_MAX_PRIORITY;
- TString prStr;
- if (ctx.GetValue("LogLevel", prStr)) {
- if (!TryFromString(prStr, priority)) {
- priority = (ELogPriority)FromString<int>(prStr);
- }
- }
- InitCustom(type, priority, threaded);
- return Slave->Init(ctx);
-}
-
-
-void TLogBackendCreatorUninitialized::ToJson(NJson::TJsonValue& value) const {
- Y_VERIFY(Slave, "Serialization off uninitialized LogBackendCreator");
- Slave->ToJson(value);
-}
-
-ILogBackendCreator::TFactory::TRegistrator<TLogBackendCreatorUninitialized> TLogBackendCreatorUninitialized::Registrar("");
+#include "uninitialized_creator.h"
+#include "filter_creator.h"
+#include "thread_creator.h"
+#include "file_creator.h"
+#include "null_creator.h"
+#include <util/string/cast.h>
+
+THolder<TLogBackend> TLogBackendCreatorUninitialized::DoCreateLogBackend() const {
+ return Slave->CreateLogBackend();
+}
+
+void TLogBackendCreatorUninitialized::InitCustom(const TString& type, ELogPriority priority, bool threaded) {
+ if (!type) {
+ Slave = MakeHolder<TNullLogBackendCreator>();
+ } else if (TFactory::Has(type)) {
+ Slave = TFactory::MakeHolder(type);
+ } else {
+ Slave = MakeHolder<TFileLogBackendCreator>(type);
+ }
+
+ if (threaded) {
+ Slave = MakeHolder<TOwningThreadedLogBackendCreator>(std::move(Slave));
+ }
+
+ if (priority != LOG_MAX_PRIORITY) {
+ Slave = MakeHolder<TFilteredBackendCreator>(std::move(Slave), priority);
+ }
+}
+
+bool TLogBackendCreatorUninitialized::Init(const IInitContext& ctx) {
+ auto type = ctx.GetOrElse("LoggerType", TString());
+ bool threaded = ctx.GetOrElse("Threaded", false);
+ ELogPriority priority = LOG_MAX_PRIORITY;
+ TString prStr;
+ if (ctx.GetValue("LogLevel", prStr)) {
+ if (!TryFromString(prStr, priority)) {
+ priority = (ELogPriority)FromString<int>(prStr);
+ }
+ }
+ InitCustom(type, priority, threaded);
+ return Slave->Init(ctx);
+}
+
+
+void TLogBackendCreatorUninitialized::ToJson(NJson::TJsonValue& value) const {
+ Y_VERIFY(Slave, "Serialization off uninitialized LogBackendCreator");
+ Slave->ToJson(value);
+}
+
+ILogBackendCreator::TFactory::TRegistrator<TLogBackendCreatorUninitialized> TLogBackendCreatorUninitialized::Registrar("");