diff options
author | Andrey Fomichev <andrey.fomichev@gmail.com> | 2022-02-10 16:49:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:15 +0300 |
commit | 1c61afbf3db63940d05e6fefa3104b03457788a1 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/logger | |
parent | e542cc14db4240643a06bb0dde87ecf361f101ab (diff) | |
download | ydb-1c61afbf3db63940d05e6fefa3104b03457788a1.tar.gz |
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 2 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 21643afdc7a..e1d70cc3d28 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 1d6130b7f7d..a02f250b002 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 5696fde561f..d2a9fa0a073 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 044219ca7f8..feb240afcbd 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 f2b58fcc82b..42233f63d25 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 9c7c1429071..b8c60b30235 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) |