backend.h 738 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "priority.h"
  3. #include <util/generic/noncopyable.h>
  4. #include <cstddef>
  5. struct TLogRecord;
  6. // NOTE: be aware that all `TLogBackend`s are registred in singleton.
  7. class TLogBackend: public TNonCopyable {
  8. public:
  9. TLogBackend() noexcept;
  10. virtual ~TLogBackend();
  11. virtual void WriteData(const TLogRecord& rec) = 0;
  12. virtual void ReopenLog() = 0;
  13. // Does not guarantee consistency with previous WriteData() calls:
  14. // log entries could be written to the new (reopened) log file due to
  15. // buffering effects.
  16. virtual void ReopenLogNoFlush();
  17. virtual ELogPriority FiltrationLevel() const;
  18. static void ReopenAllBackends(bool flush = true);
  19. virtual size_t QueueSize() const;
  20. };