aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/backend.h
blob: 20e01eabd1e11da24cc5925a8164ce2cd2d60d8d (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;
};