diff options
author | stanly <stanly@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
commit | cde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch) | |
tree | d3349caea4095825a55b5ba24fe758067b29ce6f /library/cpp/logger | |
parent | 9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff) | |
download | ydb-cde218e65dfef5ce03a48d641fd8f7913cf17b2d.tar.gz |
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/logger')
-rw-r--r-- | library/cpp/logger/global/global.h | 8 | ||||
-rw-r--r-- | library/cpp/logger/log.cpp | 28 | ||||
-rw-r--r-- | library/cpp/logger/log.h | 14 |
3 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/logger/global/global.h b/library/cpp/logger/global/global.h index cbe71b16ea..8a274cbc1b 100644 --- a/library/cpp/logger/global/global.h +++ b/library/cpp/logger/global/global.h @@ -24,8 +24,8 @@ public: { } - TGlobalLog(THolder<TLogBackend> backend) - : TLog(std::move(backend)) + TGlobalLog(THolder<TLogBackend> backend) + : TLog(std::move(backend)) { } }; @@ -40,8 +40,8 @@ public: { } - TNullLog(THolder<TLogBackend> backend) - : TLog(std::move(backend)) + TNullLog(THolder<TLogBackend> backend) + : TLog(std::move(backend)) { } }; diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp index e1d70cc3d2..57e1b16475 100644 --- a/library/cpp/logger/log.cpp +++ b/library/cpp/logger/log.cpp @@ -12,17 +12,17 @@ #include <util/generic/scope.h> #include <util/generic/yexception.h> -THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority, bool threaded) { +THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority, bool threaded) { TLogBackendCreatorUninitialized creator; creator.InitCustom(fname, priority, threaded); return creator.CreateLogBackend(); } -THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority, size_t queueLen) { +THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority, size_t queueLen) { return MakeHolder<TFilteredLogBackend>(CreateOwningThreadedLogBackend(fname, queueLen), priority); } -THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen) { +THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen) { return MakeHolder<TOwningThreadedLogBackend>(CreateLogBackend(fname, LOG_MAX_PRIORITY, false).Release(), queueLen); } @@ -45,7 +45,7 @@ class TLog::TImpl: public TAtomicRefCount<TImpl> { }; public: - inline TImpl(THolder<TLogBackend> backend) + inline TImpl(THolder<TLogBackend> backend) : Backend_(std::move(backend)) { } @@ -76,11 +76,11 @@ public: Printf(ls, format, args); } - inline void ResetBackend(THolder<TLogBackend> backend) noexcept { + inline void ResetBackend(THolder<TLogBackend> backend) noexcept { Backend_ = std::move(backend); } - inline THolder<TLogBackend> ReleaseBackend() noexcept { + inline THolder<TLogBackend> ReleaseBackend() noexcept { return std::move(Backend_); } @@ -135,7 +135,7 @@ TLog::TLog(const TString& fname, ELogPriority priority) { } -TLog::TLog(THolder<TLogBackend> backend) +TLog::TLog(THolder<TLogBackend> backend) : Impl_(MakeIntrusive<TImpl>(std::move(backend))) { } @@ -214,15 +214,15 @@ bool TLog::OpenLog(const char* path, ELogPriority lp) { return true; } -void TLog::ResetBackend(THolder<TLogBackend> backend) noexcept { - Impl_->ResetBackend(std::move(backend)); +void TLog::ResetBackend(THolder<TLogBackend> backend) noexcept { + Impl_->ResetBackend(std::move(backend)); } bool TLog::IsNullLog() const noexcept { return Impl_->IsNullLog(); } -THolder<TLogBackend> TLog::ReleaseBackend() noexcept { +THolder<TLogBackend> TLog::ReleaseBackend() noexcept { return Impl_->ReleaseBackend(); } @@ -235,10 +235,10 @@ void TLog::Write(ELogPriority priority, const char* data, size_t len) const { } } -void TLog::Write(ELogPriority priority, const TStringBuf data) const { - Write(priority, data.data(), data.size()); -} - +void TLog::Write(ELogPriority priority, const TStringBuf data) const { + Write(priority, data.data(), data.size()); +} + void TLog::Write(const char* data, size_t len) const { Write(Impl_->DefaultPriority(), data, len); } diff --git a/library/cpp/logger/log.h b/library/cpp/logger/log.h index 8be984ccc8..59409b4778 100644 --- a/library/cpp/logger/log.h +++ b/library/cpp/logger/log.h @@ -8,7 +8,7 @@ #include <util/generic/fwd.h> #include <util/generic/ptr.h> - + #include <functional> #include <cstdarg> @@ -37,7 +37,7 @@ public: // Construct file logger. TLog(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY); // Construct any type of logger - TLog(THolder<TLogBackend> backend); + TLog(THolder<TLogBackend> backend); TLog(const TLog&); TLog(TLog&&); @@ -47,10 +47,10 @@ public: // Change underlying backend. // NOTE: not thread safe. - void ResetBackend(THolder<TLogBackend> backend) noexcept; + void ResetBackend(THolder<TLogBackend> backend) noexcept; // Reset underlying backend, `IsNullLog()` will return `true` after this call. // NOTE: not thread safe. - THolder<TLogBackend> ReleaseBackend() noexcept; + THolder<TLogBackend> ReleaseBackend() noexcept; // Check if underlying backend is defined and is not null. // NOTE: not thread safe with respect to `ResetBackend` and `ReleaseBackend`. bool IsNullLog() const noexcept; @@ -110,6 +110,6 @@ private: TLogFormatter Formatter_; }; -THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, bool threaded = false); -THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, size_t queueLen = 0); -THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen = 0); +THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, bool threaded = false); +THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, size_t queueLen = 0); +THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen = 0); |