aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/logging/backends/stream/unittests/stream_log_manager_ut.cpp
blob: cb3e244e3b95a3dd5d539426d8fe0b1705222f01 (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
#include <library/cpp/testing/gtest/gtest.h>

#include <library/cpp/yt/logging/logger.h>

#include <library/cpp/yt/logging/backends/stream/stream_log_manager.h>

#include <util/stream/str.h>

#include <util/string/split.h>

namespace NYT::NLogging {
namespace {

////////////////////////////////////////////////////////////////////////////////

TEST(TStreamLogManagerTest, Simple)
{
    TString str;
    {
        TStringOutput output(str);
        auto logManager = CreateStreamLogManager(&output);
        TLogger Logger(logManager.get(), "Test");
        YT_LOG_INFO("Hello world");
    }

    TVector<TStringBuf> tokens;
    Split(str, "\t", tokens);
    EXPECT_GE(std::ssize(tokens), 4);
    EXPECT_EQ(tokens[1], "I");
    EXPECT_EQ(tokens[2], "Test");
    EXPECT_EQ(tokens[3], "Hello world");
}

////////////////////////////////////////////////////////////////////////////////

} // namespace
} // namespace NYT::NLogging