Просмотр исходного кода

Сделать нормальное логгирование в UaaS

conterouz 1 год назад
Родитель
Сommit
dab0d384d5
3 измененных файлов с 5 добавлено и 0 удалено
  1. 1 0
      library/cpp/logger/composite.cpp
  2. 1 0
      library/cpp/logger/composite.h
  3. 3 0
      library/cpp/logger/log.h

+ 1 - 0
library/cpp/logger/composite.cpp

@@ -14,5 +14,6 @@ void TCompositeLogBackend::ReopenLog() {
 }
 }
 
 
 void TCompositeLogBackend::AddLogBackend(THolder<TLogBackend>&& backend) {
 void TCompositeLogBackend::AddLogBackend(THolder<TLogBackend>&& backend) {
+    LogPriority = Max(LogPriority, backend->FiltrationLevel());
     Slaves.emplace_back(std::move(backend));
     Slaves.emplace_back(std::move(backend));
 }
 }

+ 1 - 0
library/cpp/logger/composite.h

@@ -11,4 +11,5 @@ public:
 
 
 private:
 private:
     TVector<THolder<TLogBackend>> Slaves;
     TVector<THolder<TLogBackend>> Slaves;
+    ELogPriority LogPriority = static_cast<ELogPriority>(0); // has now it's own priority by default
 };
 };

+ 3 - 0
library/cpp/logger/log.h

@@ -54,6 +54,9 @@ public:
     // Check if underlying backend is defined and is not null.
     // Check if underlying backend is defined and is not null.
     // NOTE: not thread safe with respect to `ResetBackend` and `ReleaseBackend`.
     // NOTE: not thread safe with respect to `ResetBackend` and `ReleaseBackend`.
     bool IsNullLog() const noexcept;
     bool IsNullLog() const noexcept;
+    bool IsNotNullLog() const noexcept {
+        return !IsNullLog();
+    }
 
 
     // Write message to the log.
     // Write message to the log.
     //
     //