diff options
author | dima-zakharov <dima-zakharov@yandex-team.ru> | 2022-02-10 16:46:02 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:02 +0300 |
commit | 41e8c41790ddd8d92722a09f7d4e1934aefff0c5 (patch) | |
tree | 2f175d77fb38a4093ccc33353129ccff1e7db7ce /library/cpp/logger/thread.cpp | |
parent | ed935c8a4c7e6ca561c19047402b0f7442175b51 (diff) | |
download | ydb-41e8c41790ddd8d92722a09f7d4e1934aefff0c5.tar.gz |
Restoring authorship annotation for <dima-zakharov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/logger/thread.cpp')
-rw-r--r-- | library/cpp/logger/thread.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/logger/thread.cpp b/library/cpp/logger/thread.cpp index 0ccf9e374b..d12c5ee2fd 100644 --- a/library/cpp/logger/thread.cpp +++ b/library/cpp/logger/thread.cpp @@ -58,9 +58,9 @@ class TThreadedLogBackend::TImpl { }; public: - inline TImpl(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}) + inline TImpl(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}) : Slave_(slave) - , QueueOverflowCallback_(std::move(queueOverflowCallback)) + , QueueOverflowCallback_(std::move(queueOverflowCallback)) { Queue_.Start(1, queuelen); } @@ -72,14 +72,14 @@ public: inline void WriteData(const TLogRecord& rec) { THolder<TRec> obj(new (rec.Len) TRec(this, rec)); - if (Queue_.Add(obj.Get())) { - Y_UNUSED(obj.Release()); - return; - } - - if (QueueOverflowCallback_) { - QueueOverflowCallback_(); - } else { + if (Queue_.Add(obj.Get())) { + Y_UNUSED(obj.Release()); + return; + } + + if (QueueOverflowCallback_) { + QueueOverflowCallback_(); + } else { ythrow yexception() << "log queue exhausted"; } } @@ -113,7 +113,7 @@ public: private: TLogBackend* Slave_; TThreadPool Queue_{"ThreadedLogBack"}; - const std::function<void()> QueueOverflowCallback_; + const std::function<void()> QueueOverflowCallback_; }; TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave) @@ -121,8 +121,8 @@ TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave) { } -TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) - : Impl_(new TImpl(slave, queuelen, std::move(queueOverflowCallback))) +TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) + : Impl_(new TImpl(slave, queuelen, std::move(queueOverflowCallback))) { } @@ -155,9 +155,9 @@ TOwningThreadedLogBackend::TOwningThreadedLogBackend(TLogBackend* slave) { } -TOwningThreadedLogBackend::TOwningThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) +TOwningThreadedLogBackend::TOwningThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) : THolder<TLogBackend>(slave) - , TThreadedLogBackend(Get(), queuelen, std::move(queueOverflowCallback)) + , TThreadedLogBackend(Get(), queuelen, std::move(queueOverflowCallback)) { } |