aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/backend.h
blob: d088726d6d46592904b3f7ce7e25fef04ea857e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include "priority.h"

#include <util/generic/noncopyable.h>

#include <cstddef>

struct TLogRecord;

// NOTE: be aware that all `TLogBackend`s are registred in singleton.
class TLogBackend: public TNonCopyable {
public:
    TLogBackend() noexcept;
    virtual ~TLogBackend();

    virtual void WriteData(const TLogRecord& rec) = 0;
    virtual void ReopenLog() = 0;

    // Does not guarantee consistency with previous WriteData() calls:
    // log entries could be written to the new (reopened) log file due to
    // buffering effects.
    virtual void ReopenLogNoFlush();

    virtual ELogPriority FiltrationLevel() const;

    static void ReopenAllBackends(bool flush = true);

    virtual size_t QueueSize() const;
};