diff options
| author | eeight <[email protected]> | 2022-02-10 16:46:19 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:19 +0300 | 
| commit | bd085aee9b4f7a0bee302ce687964ffb7098f986 (patch) | |
| tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/logger/global/common.cpp | |
| parent | 475c0a46f28166e83fd263badc7546377cddcabe (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
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 41138d81057..4fb05c19b4b 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) { | 
