diff options
Diffstat (limited to 'library/cpp/logger/global/common.cpp')
-rw-r--r-- | library/cpp/logger/global/common.cpp | 30 |
1 files changed, 15 insertions, 15 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) { |