aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/stream.h
blob: a5eca9060e3b28cdfdf181b2b1bcc5b35495adf8 (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
31
32
33
34
35
#pragma once

#include "backend.h"

#include <util/generic/string.h>


class IOutputStream;

class TStreamLogBackend : public TLogBackend {
public:
    explicit TStreamLogBackend(IOutputStream* slave);
    ~TStreamLogBackend() override;

    void WriteData(const TLogRecord& rec) override;
    void ReopenLog() override;

private:
    IOutputStream* Slave_;
};

class TStreamWithContextLogBackend : public TLogBackend {
private:
    static constexpr TStringBuf DELIMITER = "; ";

public:
    explicit TStreamWithContextLogBackend(IOutputStream* slave);
    ~TStreamWithContextLogBackend() override;

    void WriteData(const TLogRecord& rec) override;
    void ReopenLog() override;

private:
    IOutputStream* Slave_;
};