blob: 7696ea4a83b42a42fdc2e8a6d3a32c8297dda795 (
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
|
#include <library/cpp/testing/gtest/gtest.h>
#include <library/cpp/yt/logging/logger.h>
namespace NYT::NLogging {
namespace {
////////////////////////////////////////////////////////////////////////////////
TEST(TLogger, NullByDefault)
{
{
TLogger logger;
EXPECT_FALSE(logger);
EXPECT_FALSE(logger.IsLevelEnabled(ELogLevel::Fatal));
}
{
TLogger logger{"Category"};
EXPECT_FALSE(logger);
EXPECT_FALSE(logger.IsLevelEnabled(ELogLevel::Fatal));
}
}
TEST(TLogger, CopyOfNullLogger)
{
TLogger nullLogger{/*logManager*/ nullptr, "Category"};
ASSERT_FALSE(nullLogger);
auto logger = nullLogger.WithMinLevel(ELogLevel::Debug);
EXPECT_FALSE(logger);
EXPECT_FALSE(logger.IsLevelEnabled(ELogLevel::Fatal));
}
////////////////////////////////////////////////////////////////////////////////
} // namespace
} // namespace NYT::NLogging
|