Browse Source

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

conterouz 1 year ago
parent
commit
dab0d384d5
3 changed files with 5 additions and 0 deletions
  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) {
+    LogPriority = Max(LogPriority, backend->FiltrationLevel());
     Slaves.emplace_back(std::move(backend));
 }

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

@@ -11,4 +11,5 @@ public:
 
 private:
     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.
     // NOTE: not thread safe with respect to `ResetBackend` and `ReleaseBackend`.
     bool IsNullLog() const noexcept;
+    bool IsNotNullLog() const noexcept {
+        return !IsNullLog();
+    }
 
     // Write message to the log.
     //