aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/backend.cpp
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.ru>2022-02-10 16:47:33 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:33 +0300
commitcba5d9a444e2cfe105f55ccda66cd21d50440017 (patch)
tree79983e83d1a91aebeb1999338090eec69e24cc33 /library/cpp/logger/backend.cpp
parenteb540cc7a103419462d0cc870ca403966e2194c6 (diff)
downloadydb-cba5d9a444e2cfe105f55ccda66cd21d50440017.tar.gz
Restoring authorship annotation for <ivanmorozov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/logger/backend.cpp')
-rw-r--r--library/cpp/logger/backend.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/library/cpp/logger/backend.cpp b/library/cpp/logger/backend.cpp
index b26bf5e88c..e0ea81471d 100644
--- a/library/cpp/logger/backend.cpp
+++ b/library/cpp/logger/backend.cpp
@@ -1,66 +1,66 @@
#include "backend.h"
-#include <util/generic/vector.h>
-#include <util/system/mutex.h>
-#include <util/generic/singleton.h>
+#include <util/generic/vector.h>
+#include <util/system/mutex.h>
+#include <util/generic/singleton.h>
#include <util/generic/yexception.h>
-namespace {
- class TGlobalLogsStorage {
- private:
+namespace {
+ class TGlobalLogsStorage {
+ private:
TVector<TLogBackend*> Backends;
- TMutex Mutex;
+ TMutex Mutex;
- public:
- void Register(TLogBackend* backend) {
- TGuard<TMutex> g(Mutex);
- Backends.push_back(backend);
- }
-
- void UnRegister(TLogBackend* backend) {
- TGuard<TMutex> g(Mutex);
- for (ui32 i = 0; i < Backends.size(); ++i) {
- if (Backends[i] == backend) {
- Backends.erase(Backends.begin() + i);
- return;
- }
- }
+ public:
+ void Register(TLogBackend* backend) {
+ TGuard<TMutex> g(Mutex);
+ Backends.push_back(backend);
+ }
+
+ void UnRegister(TLogBackend* backend) {
+ TGuard<TMutex> g(Mutex);
+ for (ui32 i = 0; i < Backends.size(); ++i) {
+ if (Backends[i] == backend) {
+ Backends.erase(Backends.begin() + i);
+ return;
+ }
+ }
Y_FAIL("Incorrect pointer for log backend");
- }
-
+ }
+
void Reopen(bool flush) {
- TGuard<TMutex> g(Mutex);
- for (auto& b : Backends) {
+ TGuard<TMutex> g(Mutex);
+ for (auto& b : Backends) {
if (flush) {
b->ReopenLog();
} else {
b->ReopenLogNoFlush();
}
- }
- }
- };
-}
-
+ }
+ }
+ };
+}
+
template <>
-class TSingletonTraits<TGlobalLogsStorage> {
-public:
- static const size_t Priority = 50;
-};
-
+class TSingletonTraits<TGlobalLogsStorage> {
+public:
+ static const size_t Priority = 50;
+};
+
ELogPriority TLogBackend::FiltrationLevel() const {
- return LOG_MAX_PRIORITY;
-}
-
+ return LOG_MAX_PRIORITY;
+}
+
TLogBackend::TLogBackend() noexcept {
- Singleton<TGlobalLogsStorage>()->Register(this);
+ Singleton<TGlobalLogsStorage>()->Register(this);
}
TLogBackend::~TLogBackend() {
- Singleton<TGlobalLogsStorage>()->UnRegister(this);
+ Singleton<TGlobalLogsStorage>()->UnRegister(this);
}
-
+
void TLogBackend::ReopenLogNoFlush() {
ReopenLog();
-}
+}
void TLogBackend::ReopenAllBackends(bool flush) {
Singleton<TGlobalLogsStorage>()->Reopen(flush);