aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/stream.cpp
blob: 73cd5030aceabaefbecd399b094d130baecc91a4 (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
36
37
38
39
40
#include "stream.h"
#include "record.h"

#include <util/stream/output.h>


TStreamLogBackend::TStreamLogBackend(IOutputStream* slave)
    : Slave_(slave)
{
}

TStreamLogBackend::~TStreamLogBackend() {
}

void TStreamLogBackend::WriteData(const TLogRecord& rec) {
    Slave_->Write(rec.Data, rec.Len);
}

void TStreamLogBackend::ReopenLog() {
}

TStreamWithContextLogBackend::TStreamWithContextLogBackend(IOutputStream* slave)
    : Slave_(slave)
{
}

TStreamWithContextLogBackend::~TStreamWithContextLogBackend() {
}

void TStreamWithContextLogBackend::WriteData(const TLogRecord& rec) {
    Slave_->Write(rec.Data, rec.Len);
    Slave_->Write(DELIMITER);
    for (const auto& [key, value] : rec.MetaFlags) {
        Slave_->Write(TString::Join(key, "=", value));
        Slave_->Write(DELIMITER);
    }
}

void TStreamWithContextLogBackend::ReopenLog() {
}