aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvarvar4ik <varvar4ik@yandex-team.ru>2022-02-10 16:50:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:12 +0300
commitf5256e2807bd0fc8626a4ce002a83b9b13860269 (patch)
treeaabfc2cd4e19e47ba787880ae1834c7ccbc09916
parentbd077d09a08e659195376ee97dc24728bb554246 (diff)
downloadydb-f5256e2807bd0fc8626a4ce002a83b9b13860269.tar.gz
Restoring authorship annotation for <varvar4ik@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--library/cpp/logger/backend.cpp24
-rw-r--r--library/cpp/logger/backend.h14
-rw-r--r--library/cpp/logger/log.cpp24
-rw-r--r--library/cpp/logger/log.h2
-rw-r--r--library/cpp/logger/log_ut.cpp40
-rw-r--r--library/cpp/logger/thread.cpp16
-rw-r--r--library/cpp/logger/thread.h2
7 files changed, 61 insertions, 61 deletions
diff --git a/library/cpp/logger/backend.cpp b/library/cpp/logger/backend.cpp
index b26bf5e88c..530f938053 100644
--- a/library/cpp/logger/backend.cpp
+++ b/library/cpp/logger/backend.cpp
@@ -27,14 +27,14 @@ namespace {
Y_FAIL("Incorrect pointer for log backend");
}
- void Reopen(bool flush) {
+ void Reopen(bool flush) {
TGuard<TMutex> g(Mutex);
for (auto& b : Backends) {
- if (flush) {
- b->ReopenLog();
- } else {
- b->ReopenLogNoFlush();
- }
+ if (flush) {
+ b->ReopenLog();
+ } else {
+ b->ReopenLogNoFlush();
+ }
}
}
};
@@ -58,13 +58,13 @@ TLogBackend::~TLogBackend() {
Singleton<TGlobalLogsStorage>()->UnRegister(this);
}
-void TLogBackend::ReopenLogNoFlush() {
- ReopenLog();
-}
-
-void TLogBackend::ReopenAllBackends(bool flush) {
- Singleton<TGlobalLogsStorage>()->Reopen(flush);
+void TLogBackend::ReopenLogNoFlush() {
+ ReopenLog();
}
+
+void TLogBackend::ReopenAllBackends(bool flush) {
+ Singleton<TGlobalLogsStorage>()->Reopen(flush);
+}
size_t TLogBackend::QueueSize() const {
ythrow yexception() << "Not implemented.";
diff --git a/library/cpp/logger/backend.h b/library/cpp/logger/backend.h
index d088726d6d..e530fb2774 100644
--- a/library/cpp/logger/backend.h
+++ b/library/cpp/logger/backend.h
@@ -16,15 +16,15 @@ public:
virtual void WriteData(const TLogRecord& rec) = 0;
virtual void ReopenLog() = 0;
-
- // Does not guarantee consistency with previous WriteData() calls:
- // log entries could be written to the new (reopened) log file due to
- // buffering effects.
- virtual void ReopenLogNoFlush();
-
+
+ // Does not guarantee consistency with previous WriteData() calls:
+ // log entries could be written to the new (reopened) log file due to
+ // buffering effects.
+ virtual void ReopenLogNoFlush();
+
virtual ELogPriority FiltrationLevel() const;
- static void ReopenAllBackends(bool flush = true);
+ static void ReopenAllBackends(bool flush = true);
virtual size_t QueueSize() const;
};
diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp
index e1d70cc3d2..23493158c8 100644
--- a/library/cpp/logger/log.cpp
+++ b/library/cpp/logger/log.cpp
@@ -58,14 +58,14 @@ public:
Backend_->ReopenLog();
}
- inline void ReopenLogNoFlush() {
- if (!IsOpen()) {
- return;
- }
-
+ inline void ReopenLogNoFlush() {
+ if (!IsOpen()) {
+ return;
+ }
+
Backend_->ReopenLogNoFlush();
- }
-
+ }
+
inline void AddLog(ELogPriority priority, const char* format, va_list args) const {
if (!IsOpen()) {
return;
@@ -182,12 +182,12 @@ void TLog::ReopenLog() {
}
}
-void TLog::ReopenLogNoFlush() {
+void TLog::ReopenLogNoFlush() {
if (const auto copy = Impl_) {
- copy->ReopenLogNoFlush();
- }
-}
-
+ copy->ReopenLogNoFlush();
+ }
+}
+
void TLog::CloseLog() {
Impl_->CloseLog();
}
diff --git a/library/cpp/logger/log.h b/library/cpp/logger/log.h
index 8be984ccc8..4b29ee69a7 100644
--- a/library/cpp/logger/log.h
+++ b/library/cpp/logger/log.h
@@ -73,7 +73,7 @@ public:
// Call `ReopenLog()` of the underlying backend.
void ReopenLog();
// Call `ReopenLogNoFlush()` of the underlying backend.
- void ReopenLogNoFlush();
+ void ReopenLogNoFlush();
// Call `QueueSize()` of the underlying backend.
size_t BackEndQueueSize() const;
diff --git a/library/cpp/logger/log_ut.cpp b/library/cpp/logger/log_ut.cpp
index 8de46f17f5..7456f7273b 100644
--- a/library/cpp/logger/log_ut.cpp
+++ b/library/cpp/logger/log_ut.cpp
@@ -17,7 +17,7 @@ class TLogTest: public TTestBase {
UNIT_TEST(TestWrite)
UNIT_TEST(TestThreaded)
UNIT_TEST(TestThreadedWithOverflow)
- UNIT_TEST(TestNoFlush)
+ UNIT_TEST(TestNoFlush)
UNIT_TEST_SUITE_END();
private:
@@ -26,7 +26,7 @@ private:
void TestWrite();
void TestThreaded();
void TestThreadedWithOverflow();
- void TestNoFlush();
+ void TestNoFlush();
void SetUp() override;
void TearDown() override;
};
@@ -131,25 +131,25 @@ void TLogTest::TestThreadedWithOverflow() {
}
}
-void TLogTest::TestNoFlush() {
- {
- TFileLogBackend fb(LOGFILE);
+void TLogTest::TestNoFlush() {
+ {
+ TFileLogBackend fb(LOGFILE);
TLog log(THolder(new TThreadedLogBackend(&fb)));
-
- int v1 = 12;
- unsigned v2 = 34;
- double v3 = 3.0;
- const char* v4 = "qwqwqw";
-
- log.ReopenLogNoFlush();
- log.AddLog("some useful data %d, %u, %lf, %s\n", v1, v2, v3, v4);
- }
-
- TBlob data = TBlob::FromFileSingleThreaded(LOGFILE);
-
- UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n");
-}
-
+
+ int v1 = 12;
+ unsigned v2 = 34;
+ double v3 = 3.0;
+ const char* v4 = "qwqwqw";
+
+ log.ReopenLogNoFlush();
+ log.AddLog("some useful data %d, %u, %lf, %s\n", v1, v2, v3, v4);
+ }
+
+ TBlob data = TBlob::FromFileSingleThreaded(LOGFILE);
+
+ UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n");
+}
+
void TLogTest::TestFormat() {
TStringStream data;
diff --git a/library/cpp/logger/thread.cpp b/library/cpp/logger/thread.cpp
index 0ccf9e374b..c581b8910a 100644
--- a/library/cpp/logger/thread.cpp
+++ b/library/cpp/logger/thread.cpp
@@ -102,10 +102,10 @@ public:
reopener->Wait();
}
- inline void ReopenLogNoFlush() {
- Slave_->ReopenLogNoFlush();
- }
-
+ inline void ReopenLogNoFlush() {
+ Slave_->ReopenLogNoFlush();
+ }
+
inline size_t QueueSize() const {
return Queue_.Size();
}
@@ -137,10 +137,10 @@ void TThreadedLogBackend::ReopenLog() {
Impl_->ReopenLog();
}
-void TThreadedLogBackend::ReopenLogNoFlush() {
- Impl_->ReopenLogNoFlush();
-}
-
+void TThreadedLogBackend::ReopenLogNoFlush() {
+ Impl_->ReopenLogNoFlush();
+}
+
void TThreadedLogBackend::WriteEmergencyData(const TLogRecord& rec) {
Impl_->WriteEmergencyData(rec);
}
diff --git a/library/cpp/logger/thread.h b/library/cpp/logger/thread.h
index 65f7a88e87..6a934f4f53 100644
--- a/library/cpp/logger/thread.h
+++ b/library/cpp/logger/thread.h
@@ -14,7 +14,7 @@ public:
void WriteData(const TLogRecord& rec) override;
void ReopenLog() override;
- void ReopenLogNoFlush() override;
+ void ReopenLogNoFlush() override;
size_t QueueSize() const override;
// Write an emergency message when the memory allocator is corrupted.