diff options
author | ndnuriev <ndnuriev@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:45 +0300 |
commit | 3659e5861440ac98d0380de7698601ad14655a7a (patch) | |
tree | a8cbee25ef3f89582ff526208677df7d14c75c98 /library/cpp/logger | |
parent | bfd0aa05cabedcab6f4c4d36948dc7581e476782 (diff) | |
download | ydb-3659e5861440ac98d0380de7698601ad14655a7a.tar.gz |
Restoring authorship annotation for <ndnuriev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/logger')
-rw-r--r-- | library/cpp/logger/backend.cpp | 2 | ||||
-rw-r--r-- | library/cpp/logger/backend.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/element.cpp | 2 | ||||
-rw-r--r-- | library/cpp/logger/element.h | 8 | ||||
-rw-r--r-- | library/cpp/logger/filter.h | 6 | ||||
-rw-r--r-- | library/cpp/logger/global/common.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/global/global.h | 4 | ||||
-rw-r--r-- | library/cpp/logger/global/rty_formater_ut.cpp | 8 | ||||
-rw-r--r-- | library/cpp/logger/log.cpp | 24 | ||||
-rw-r--r-- | library/cpp/logger/log.h | 12 | ||||
-rw-r--r-- | library/cpp/logger/priority.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/record.h | 4 | ||||
-rw-r--r-- | library/cpp/logger/system.cpp | 4 | ||||
-rw-r--r-- | library/cpp/logger/system.h | 2 |
14 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/logger/backend.cpp b/library/cpp/logger/backend.cpp index b26bf5e88c..af05a212af 100644 --- a/library/cpp/logger/backend.cpp +++ b/library/cpp/logger/backend.cpp @@ -46,7 +46,7 @@ public: static const size_t Priority = 50; }; -ELogPriority TLogBackend::FiltrationLevel() const { +ELogPriority TLogBackend::FiltrationLevel() const { return LOG_MAX_PRIORITY; } diff --git a/library/cpp/logger/backend.h b/library/cpp/logger/backend.h index d088726d6d..b351f360a6 100644 --- a/library/cpp/logger/backend.h +++ b/library/cpp/logger/backend.h @@ -22,7 +22,7 @@ public: // buffering effects. virtual void ReopenLogNoFlush(); - virtual ELogPriority FiltrationLevel() const; + virtual ELogPriority FiltrationLevel() const; static void ReopenAllBackends(bool flush = true); diff --git a/library/cpp/logger/element.cpp b/library/cpp/logger/element.cpp index b510fe16e1..0dd249adcb 100644 --- a/library/cpp/logger/element.cpp +++ b/library/cpp/logger/element.cpp @@ -10,7 +10,7 @@ TLogElement::TLogElement(const TLog* parent) Reset(); } -TLogElement::TLogElement(const TLog* parent, ELogPriority priority) +TLogElement::TLogElement(const TLog* parent, ELogPriority priority) : Parent_(parent) , Priority_(priority) { diff --git a/library/cpp/logger/element.h b/library/cpp/logger/element.h index fc9bff851f..dad0886c2c 100644 --- a/library/cpp/logger/element.h +++ b/library/cpp/logger/element.h @@ -12,7 +12,7 @@ class TLog; class TLogElement: public TTempBufOutput { public: TLogElement(const TLog* parent); - TLogElement(const TLog* parent, ELogPriority priority); + TLogElement(const TLog* parent, ELogPriority priority); TLogElement(TLogElement&&) noexcept = default; TLogElement& operator=(TLogElement&&) noexcept = default; @@ -29,13 +29,13 @@ public: /* * for pretty usage: logger << TLOG_ERROR << "Error description"; */ - inline TLogElement& operator<<(ELogPriority priority) { + inline TLogElement& operator<<(ELogPriority priority) { Flush(); Priority_ = priority; return *this; } - ELogPriority Priority() const noexcept { + ELogPriority Priority() const noexcept { return Priority_; } @@ -44,5 +44,5 @@ protected: protected: const TLog* Parent_; - ELogPriority Priority_; + ELogPriority Priority_; }; diff --git a/library/cpp/logger/filter.h b/library/cpp/logger/filter.h index 9ef83fb58c..7166f727da 100644 --- a/library/cpp/logger/filter.h +++ b/library/cpp/logger/filter.h @@ -7,7 +7,7 @@ class TFilteredLogBackend: public TLogBackend { THolder<TLogBackend> Backend; - ELogPriority Level; + ELogPriority Level; public: TFilteredLogBackend(THolder<TLogBackend>&& t, ELogPriority level = LOG_MAX_PRIORITY) noexcept @@ -16,7 +16,7 @@ public: { } - ELogPriority FiltrationLevel() const override { + ELogPriority FiltrationLevel() const override { return Level; } @@ -25,7 +25,7 @@ public: } void WriteData(const TLogRecord& rec) override { - if (rec.Priority <= (ELogPriority)Level) { + if (rec.Priority <= (ELogPriority)Level) { Backend->WriteData(rec); } } diff --git a/library/cpp/logger/global/common.h b/library/cpp/logger/global/common.h index 7dcf650dec..53006589a0 100644 --- a/library/cpp/logger/global/common.h +++ b/library/cpp/logger/global/common.h @@ -86,7 +86,7 @@ struct TLogRecordContext { TSourceLocation SourceLocation; TStringBuf CustomMessage; - ELogPriority Priority; + ELogPriority Priority; }; template <class... R> diff --git a/library/cpp/logger/global/global.h b/library/cpp/logger/global/global.h index cbe71b16ea..cac6d0811e 100644 --- a/library/cpp/logger/global/global.h +++ b/library/cpp/logger/global/global.h @@ -19,7 +19,7 @@ inline void InitGlobalLog2Console(int loglevel = TLOG_INFO) { class TGlobalLog: public TLog { public: - TGlobalLog(const TString& logType, ELogPriority priority = LOG_MAX_PRIORITY) + TGlobalLog(const TString& logType, ELogPriority priority = LOG_MAX_PRIORITY) : TLog(logType, priority) { } @@ -35,7 +35,7 @@ TGlobalLog* CreateDefaultLogger<TGlobalLog>(); class TNullLog: public TLog { public: - TNullLog(const TString& logType, ELogPriority priority = LOG_MAX_PRIORITY) + TNullLog(const TString& logType, ELogPriority priority = LOG_MAX_PRIORITY) : TLog(logType, priority) { } diff --git a/library/cpp/logger/global/rty_formater_ut.cpp b/library/cpp/logger/global/rty_formater_ut.cpp index 551a97c5bf..9c9b3bbbb1 100644 --- a/library/cpp/logger/global/rty_formater_ut.cpp +++ b/library/cpp/logger/global/rty_formater_ut.cpp @@ -9,22 +9,22 @@ namespace { Y_UNIT_TEST_SUITE(NLoggingImplTest) { Y_UNIT_TEST(TestTLocalTimeSToStream) { - NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); + NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); TStringStream ss; ss << lt; UNIT_ASSERT_EQUAL(ss.Str(), SampleRtyLog); } Y_UNIT_TEST(TestTLocalTimeSToString) { - NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); + NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); UNIT_ASSERT_EQUAL(TString(lt), SampleRtyLog); } Y_UNIT_TEST(TestTLocalTimeSAddLeft) { - NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); + NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); TStringBuf suffix("suffix"); UNIT_ASSERT_EQUAL(lt + suffix, TString(SampleRtyLog) + suffix); } Y_UNIT_TEST(TestTLocalTimeSAddRight) { - NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); + NLoggingImpl::TLocalTimeS lt(TInstant::ParseIso8601Deprecated(SampleISO8601)); TString prefix("prefix"); UNIT_ASSERT_EQUAL(prefix + lt, prefix + SampleRtyLog); } diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp index e1d70cc3d2..01cc4e5734 100644 --- a/library/cpp/logger/log.cpp +++ b/library/cpp/logger/log.cpp @@ -29,7 +29,7 @@ THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& class TLog::TImpl: public TAtomicRefCount<TImpl> { class TPriorityLogStream final: public IOutputStream { public: - inline TPriorityLogStream(ELogPriority p, const TImpl* parent) + inline TPriorityLogStream(ELogPriority p, const TImpl* parent) : Priority_(p) , Parent_(parent) { @@ -66,7 +66,7 @@ public: Backend_->ReopenLogNoFlush(); } - inline void AddLog(ELogPriority priority, const char* format, va_list args) const { + inline void AddLog(ELogPriority priority, const char* format, va_list args) const { if (!IsOpen()) { return; } @@ -98,21 +98,21 @@ public: Y_ASSERT(!IsOpen()); } - inline void WriteData(ELogPriority priority, const char* data, size_t len) const { + inline void WriteData(ELogPriority priority, const char* data, size_t len) const { if (IsOpen()) { Backend_->WriteData(TLogRecord(priority, data, len)); } } - inline ELogPriority DefaultPriority() noexcept { + inline ELogPriority DefaultPriority() noexcept { return DefaultPriority_; } - inline void SetDefaultPriority(ELogPriority priority) noexcept { + inline void SetDefaultPriority(ELogPriority priority) noexcept { DefaultPriority_ = priority; } - inline ELogPriority FiltrationLevel() const noexcept { + inline ELogPriority FiltrationLevel() const noexcept { return Backend_->FiltrationLevel(); } @@ -161,7 +161,7 @@ void TLog::AddLog(const char* format, ...) const { Impl_->AddLog(Impl_->DefaultPriority(), format, args); } -void TLog::AddLog(ELogPriority priority, const char* format, ...) const { +void TLog::AddLog(ELogPriority priority, const char* format, ...) const { va_list args; va_start(args, format); @@ -192,19 +192,19 @@ void TLog::CloseLog() { Impl_->CloseLog(); } -void TLog::SetDefaultPriority(ELogPriority priority) noexcept { +void TLog::SetDefaultPriority(ELogPriority priority) noexcept { Impl_->SetDefaultPriority(priority); } -ELogPriority TLog::FiltrationLevel() const noexcept { +ELogPriority TLog::FiltrationLevel() const noexcept { return Impl_->FiltrationLevel(); } -ELogPriority TLog::DefaultPriority() const noexcept { +ELogPriority TLog::DefaultPriority() const noexcept { return Impl_->DefaultPriority(); } -bool TLog::OpenLog(const char* path, ELogPriority lp) { +bool TLog::OpenLog(const char* path, ELogPriority lp) { if (path) { ResetBackend(CreateLogBackend(path, lp)); } else { @@ -226,7 +226,7 @@ THolder<TLogBackend> TLog::ReleaseBackend() noexcept { return Impl_->ReleaseBackend(); } -void TLog::Write(ELogPriority priority, const char* data, size_t len) const { +void TLog::Write(ELogPriority priority, const char* data, size_t len) const { if (Formatter_) { const auto formated = Formatter_(priority, TStringBuf{data, len}); Impl_->WriteData(priority, formated.data(), formated.size()); diff --git a/library/cpp/logger/log.h b/library/cpp/logger/log.h index 8be984ccc8..5fedf3a823 100644 --- a/library/cpp/logger/log.h +++ b/library/cpp/logger/log.h @@ -12,7 +12,7 @@ #include <functional> #include <cstdarg> -using TLogFormatter = std::function<TString(ELogPriority priority, TStringBuf)>; +using TLogFormatter = std::function<TString(ELogPriority priority, TStringBuf)>; // Logging facilities interface. // @@ -35,7 +35,7 @@ public: // Construct empty logger all writes will be spilled. TLog(); // Construct file logger. - TLog(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY); + TLog(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY); // Construct any type of logger TLog(THolder<TLogBackend> backend); @@ -63,7 +63,7 @@ public: // Write message to the log using `DefaultPriority()`. void Write(const char* data, size_t len) const; // Write message to the log, but pass the message in a c-style. - void Write(ELogPriority priority, const char* data, size_t len) const; + void Write(ELogPriority priority, const char* data, size_t len) const; // Write message to the log in a c-like printf style. void Y_PRINTF_FORMAT(3, 4) AddLog(ELogPriority priority, const char* format, ...) const; @@ -79,12 +79,12 @@ public: // Set log default priority. // NOTE: not thread safe. - void SetDefaultPriority(ELogPriority priority) noexcept; + void SetDefaultPriority(ELogPriority priority) noexcept; // Get default priority - ELogPriority DefaultPriority() const noexcept; + ELogPriority DefaultPriority() const noexcept; // Call `FiltrationLevel()` of the underlying backend. - ELogPriority FiltrationLevel() const noexcept; + ELogPriority FiltrationLevel() const noexcept; // Set current log formatter. void SetFormatter(TLogFormatter formatter) noexcept; diff --git a/library/cpp/logger/priority.h b/library/cpp/logger/priority.h index d2a9fa0a07..839dac66d5 100644 --- a/library/cpp/logger/priority.h +++ b/library/cpp/logger/priority.h @@ -1,6 +1,6 @@ #pragma once -enum ELogPriority { +enum ELogPriority { TLOG_EMERG = 0 /* "EMERG" */, TLOG_ALERT = 1 /* "ALERT" */, TLOG_CRIT = 2 /* "CRITICAL_INFO" */, diff --git a/library/cpp/logger/record.h b/library/cpp/logger/record.h index c28a7785fd..d8febe44c9 100644 --- a/library/cpp/logger/record.h +++ b/library/cpp/logger/record.h @@ -7,9 +7,9 @@ struct TLogRecord { const char* Data; size_t Len; - ELogPriority Priority; + ELogPriority Priority; - inline TLogRecord(ELogPriority priority, const char* data, size_t len) noexcept + inline TLogRecord(ELogPriority priority, const char* data, size_t len) noexcept : Data(data) , Len(len) , Priority(priority) diff --git a/library/cpp/logger/system.cpp b/library/cpp/logger/system.cpp index 42233f63d2..86c5a23d2a 100644 --- a/library/cpp/logger/system.cpp +++ b/library/cpp/logger/system.cpp @@ -54,7 +54,7 @@ TSysLogBackend::~TSysLogBackend() { void TSysLogBackend::WriteData(const TLogRecord& rec) { #if defined(_unix_) - syslog(ELogPriority2SyslogPriority(rec.Priority), "%.*s", (int)rec.Len, rec.Data); + syslog(ELogPriority2SyslogPriority(rec.Priority), "%.*s", (int)rec.Len, rec.Data); #else Y_UNUSED(rec); #endif @@ -63,7 +63,7 @@ void TSysLogBackend::WriteData(const TLogRecord& rec) { void TSysLogBackend::ReopenLog() { } -int TSysLogBackend::ELogPriority2SyslogPriority(ELogPriority priority) { +int TSysLogBackend::ELogPriority2SyslogPriority(ELogPriority priority) { #if defined(_unix_) return Min(int(priority), (int)LOG_PRIMASK); #else diff --git a/library/cpp/logger/system.h b/library/cpp/logger/system.h index b8c60b3023..14fefbf78e 100644 --- a/library/cpp/logger/system.h +++ b/library/cpp/logger/system.h @@ -52,7 +52,7 @@ public: } protected: - int ELogPriority2SyslogPriority(ELogPriority priority); + int ELogPriority2SyslogPriority(ELogPriority priority); TString Ident; EFacility Facility; |