aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/global
diff options
context:
space:
mode:
authoreeight <eeight@yandex-team.ru>2022-02-10 16:46:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:19 +0300
commitbd085aee9b4f7a0bee302ce687964ffb7098f986 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/logger/global
parent475c0a46f28166e83fd263badc7546377cddcabe (diff)
downloadydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/logger/global')
-rw-r--r--library/cpp/logger/global/common.cpp30
-rw-r--r--library/cpp/logger/global/common.h4
-rw-r--r--library/cpp/logger/global/global.cpp16
-rw-r--r--library/cpp/logger/global/global.h2
4 files changed, 26 insertions, 26 deletions
diff --git a/library/cpp/logger/global/common.cpp b/library/cpp/logger/global/common.cpp
index 41138d8105..4fb05c19b4 100644
--- a/library/cpp/logger/global/common.cpp
+++ b/library/cpp/logger/global/common.cpp
@@ -1,26 +1,26 @@
#include "common.h"
-#include <util/generic/yexception.h>
-
+#include <util/generic/yexception.h>
+
namespace NLoggingImpl {
TString GetLocalTimeSSimple() {
struct tm tm;
return Strftime("%b%d_%H%M%S", Now().LocalTime(&tm));
}
-
- TString PrepareToOpenLog(TString logType, const int logLevel, const bool rotation, const bool startAsDaemon) {
- Y_ENSURE(logLevel >= 0 && logLevel <= (int)LOG_MAX_PRIORITY, "Incorrect log level");
-
- if (rotation && TFsPath(logType).Exists()) {
- TString newPath = Sprintf("%s_%s_%" PRIu64, logType.data(), NLoggingImpl::GetLocalTimeSSimple().data(), static_cast<ui64>(Now().MicroSeconds()));
- TFsPath(logType).RenameTo(newPath);
- }
+
+ TString PrepareToOpenLog(TString logType, const int logLevel, const bool rotation, const bool startAsDaemon) {
+ Y_ENSURE(logLevel >= 0 && logLevel <= (int)LOG_MAX_PRIORITY, "Incorrect log level");
+
+ if (rotation && TFsPath(logType).Exists()) {
+ TString newPath = Sprintf("%s_%s_%" PRIu64, logType.data(), NLoggingImpl::GetLocalTimeSSimple().data(), static_cast<ui64>(Now().MicroSeconds()));
+ TFsPath(logType).RenameTo(newPath);
+ }
if (startAsDaemon && (logType == "console"sv || logType == "cout"sv || logType == "cerr"sv)) {
- logType = "null";
- }
-
- return logType;
- }
+ logType = "null";
+ }
+
+ return logType;
+ }
}
bool TLogFilter::CheckLoggingContext(TLog& log, const TLogRecordContext& context) {
diff --git a/library/cpp/logger/global/common.h b/library/cpp/logger/global/common.h
index 56fa92f0b6..7dcf650dec 100644
--- a/library/cpp/logger/global/common.h
+++ b/library/cpp/logger/global/common.h
@@ -68,12 +68,12 @@ namespace NLoggingImpl {
TString GetLocalTimeSSimple();
- // Returns correct log type to use
+ // Returns correct log type to use
TString PrepareToOpenLog(TString logType, int logLevel, bool rotation, bool startAsDaemon);
template <class TLoggerType>
void InitLogImpl(TString logType, const int logLevel, const bool rotation, const bool startAsDaemon) {
- TLoggerOperator<TLoggerType>::Set(new TLoggerType(PrepareToOpenLog(logType, logLevel, rotation, startAsDaemon), (ELogPriority)logLevel));
+ TLoggerOperator<TLoggerType>::Set(new TLoggerType(PrepareToOpenLog(logType, logLevel, rotation, startAsDaemon), (ELogPriority)logLevel));
}
}
diff --git a/library/cpp/logger/global/global.cpp b/library/cpp/logger/global/global.cpp
index 32303ef60e..9fbd10f666 100644
--- a/library/cpp/logger/global/global.cpp
+++ b/library/cpp/logger/global/global.cpp
@@ -8,14 +8,14 @@ static void DoInitGlobalLog(THolder<TGlobalLog> logger, THolder<ILoggerFormatter
TLoggerFormatterOperator::Set(formatter.Release());
}
-void DoInitGlobalLog(const TString& logType, const int logLevel, const bool rotation, const bool startAsDaemon, THolder<ILoggerFormatter> formatter, bool threaded) {
- DoInitGlobalLog(
- MakeHolder<TGlobalLog>(
- CreateLogBackend(
- NLoggingImpl::PrepareToOpenLog(logType, logLevel, rotation, startAsDaemon),
- (ELogPriority)logLevel,
- threaded)),
- std::move(formatter));
+void DoInitGlobalLog(const TString& logType, const int logLevel, const bool rotation, const bool startAsDaemon, THolder<ILoggerFormatter> formatter, bool threaded) {
+ DoInitGlobalLog(
+ MakeHolder<TGlobalLog>(
+ CreateLogBackend(
+ NLoggingImpl::PrepareToOpenLog(logType, logLevel, rotation, startAsDaemon),
+ (ELogPriority)logLevel,
+ threaded)),
+ std::move(formatter));
}
void DoInitGlobalLog(THolder<TLogBackend> backend, THolder<ILoggerFormatter> formatter) {
diff --git a/library/cpp/logger/global/global.h b/library/cpp/logger/global/global.h
index b1193ed403..cbe71b16ea 100644
--- a/library/cpp/logger/global/global.h
+++ b/library/cpp/logger/global/global.h
@@ -6,7 +6,7 @@
// ATTENTION! MUST CALL DoInitGlobalLog BEFORE USAGE
bool GlobalLogInitialized();
-void DoInitGlobalLog(const TString& logType, const int logLevel, const bool rotation, const bool startAsDaemon, THolder<ILoggerFormatter> formatter = {}, bool threaded = false);
+void DoInitGlobalLog(const TString& logType, const int logLevel, const bool rotation, const bool startAsDaemon, THolder<ILoggerFormatter> formatter = {}, bool threaded = false);
void DoInitGlobalLog(THolder<TLogBackend> backend, THolder<ILoggerFormatter> formatter = {});
inline void InitGlobalLog2Null() {