diff options
author | Andrey Fomichev <andrey.fomichev@gmail.com> | 2022-02-10 16:49:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:12 +0300 |
commit | e542cc14db4240643a06bb0dde87ecf361f101ab (patch) | |
tree | 3b03a4b94acd11a4eca042532035806e5fa08ad1 /library/cpp/logger | |
parent | e2ac73225f30f7fcf7df3cb225cba257f56144c1 (diff) | |
download | ydb-e542cc14db4240643a06bb0dde87ecf361f101ab.tar.gz |
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/logger')
-rw-r--r-- | library/cpp/logger/log.cpp | 18 | ||||
-rw-r--r-- | library/cpp/logger/null.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/priority.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/stream.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/system.cpp | 42 | ||||
-rw-r--r-- | library/cpp/logger/system.h | 24 |
6 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp index e1d70cc3d2..21643afdc7 100644 --- a/library/cpp/logger/log.cpp +++ b/library/cpp/logger/log.cpp @@ -162,16 +162,16 @@ void TLog::AddLog(const char* format, ...) const { } void TLog::AddLog(ELogPriority priority, const char* format, ...) const { - va_list args; - va_start(args, format); - + va_list args; + va_start(args, format); + Y_DEFER { - va_end(args); + va_end(args); }; - + Impl_->AddLog(priority, format, args); -} - +} + void TLog::AddLogVAList(const char* format, va_list lst) { Impl_->AddLog(Impl_->DefaultPriority(), format, lst); } @@ -233,8 +233,8 @@ void TLog::Write(ELogPriority priority, const char* data, size_t len) const { } else { Impl_->WriteData(priority, data, len); } -} - +} + void TLog::Write(ELogPriority priority, const TStringBuf data) const { Write(priority, data.data(), data.size()); } diff --git a/library/cpp/logger/null.h b/library/cpp/logger/null.h index a02f250b00..1d6130b7f7 100644 --- a/library/cpp/logger/null.h +++ b/library/cpp/logger/null.h @@ -1,7 +1,7 @@ #pragma once #include "backend.h" - + class TNullLogBackend: public TLogBackend { public: TNullLogBackend(); diff --git a/library/cpp/logger/priority.h b/library/cpp/logger/priority.h index d2a9fa0a07..5696fde561 100644 --- a/library/cpp/logger/priority.h +++ b/library/cpp/logger/priority.h @@ -10,6 +10,6 @@ enum ELogPriority { TLOG_INFO = 6 /* "INFO" */, TLOG_DEBUG = 7 /* "DEBUG" */, TLOG_RESOURCES = 8 /* "RESOURCES" */ -}; +}; #define LOG_MAX_PRIORITY TLOG_RESOURCES #define LOG_DEF_PRIORITY TLOG_INFO diff --git a/library/cpp/logger/stream.h b/library/cpp/logger/stream.h index feb240afcb..044219ca7f 100644 --- a/library/cpp/logger/stream.h +++ b/library/cpp/logger/stream.h @@ -1,7 +1,7 @@ #pragma once #include "backend.h" - + class IOutputStream; class TStreamLogBackend: public TLogBackend { diff --git a/library/cpp/logger/system.cpp b/library/cpp/logger/system.cpp index 42233f63d2..f2b58fcc82 100644 --- a/library/cpp/logger/system.cpp +++ b/library/cpp/logger/system.cpp @@ -14,11 +14,11 @@ #include "record.h" #include "stream.h" -TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags) - : Ident(ident) - , Facility(facility) - , Flags(flags) -{ +TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags) + : Ident(ident) + , Facility(facility) + , Flags(flags) +{ #if defined(_unix_) Y_ASSERT(TSYSLOG_LOCAL0 <= facility && facility <= TSYSLOG_LOCAL7); @@ -43,34 +43,34 @@ TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags) } openlog(Ident.data(), sysflags, f2sf[(size_t)facility]); -#endif -} - +#endif +} + TSysLogBackend::~TSysLogBackend() { #if defined(_unix_) - closelog(); -#endif -} - + closelog(); +#endif +} + void TSysLogBackend::WriteData(const TLogRecord& rec) { #if defined(_unix_) syslog(ELogPriority2SyslogPriority(rec.Priority), "%.*s", (int)rec.Len, rec.Data); #else Y_UNUSED(rec); -#endif -} - -void TSysLogBackend::ReopenLog() { -} - +#endif +} + +void TSysLogBackend::ReopenLog() { +} + int TSysLogBackend::ELogPriority2SyslogPriority(ELogPriority priority) { #if defined(_unix_) return Min(int(priority), (int)LOG_PRIMASK); #else - // trivial conversion - return int(priority); + // trivial conversion + return int(priority); #endif -} +} namespace { class TSysLogInstance: public TLog { diff --git a/library/cpp/logger/system.h b/library/cpp/logger/system.h index b8c60b3023..9c7c142907 100644 --- a/library/cpp/logger/system.h +++ b/library/cpp/logger/system.h @@ -12,10 +12,10 @@ (ident) ? (TLogBackend*)(new TSysLogBackend((ident), (facility), (flags))) : (TLogBackend*)(new TNullLogBackend())));\ } \ } Y_CAT(loginit, __LINE__); - + #define YSYSLOGINIT(ident, facility) YSYSLOGINIT_FLAGS((ident), (facility), 0) - -class TSysLogBackend: public TLogBackend { + +class TSysLogBackend: public TLogBackend { public: enum EFacility { TSYSLOG_LOCAL0 = 0, @@ -27,7 +27,7 @@ public: TSYSLOG_LOCAL6 = 6, TSYSLOG_LOCAL7 = 7 }; - + enum EFlags { LogPerror = 1, LogCons = 2 @@ -35,30 +35,30 @@ public: TSysLogBackend(const char* ident, EFacility facility, int flags = 0); ~TSysLogBackend() override; - + void WriteData(const TLogRecord& rec) override; void ReopenLog() override; - + virtual TString GetIdent() const { return Ident; } - + virtual EFacility GetFacility() const { return Facility; } - + virtual int GetFlags() const { return Flags; } - + protected: int ELogPriority2SyslogPriority(ELogPriority priority); - + TString Ident; EFacility Facility; int Flags; -}; - +}; + /* * return system-wide logger instance * better do not use in real programs(instead of robot, of course) |