blob: 471a0505988e75598f0e56065294bf32d46b220e (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "common.h"
namespace NMemInfo {
struct TMemInfo;
}
class ILoggerFormatter {
public:
virtual ~ILoggerFormatter() = default;
virtual void Format(const TLogRecordContext&, TLogElement&) const = 0;
};
ILoggerFormatter* CreateRtyLoggerFormatter();
namespace NLoggingImpl {
class TLocalTimeS {
public:
TLocalTimeS(TInstant instant = TInstant::Now())
: Instant(instant)
{
}
TInstant GetInstant() const {
return Instant;
}
operator TString() const;
TString operator+(TStringBuf right) const;
private:
TInstant Instant;
};
IOutputStream& operator<<(IOutputStream& out, TLocalTimeS localTimeS);
inline TLocalTimeS GetLocalTimeS() {
return TLocalTimeS();
}
TString GetSystemResources();
TString PrintSystemResources(const NMemInfo::TMemInfo& info);
struct TLoggerFormatterTraits {
static ILoggerFormatter* CreateDefault() {
return CreateRtyLoggerFormatter();
}
};
}
class TLoggerFormatterOperator : public NLoggingImpl::TOperatorBase<ILoggerFormatter, NLoggingImpl::TLoggerFormatterTraits> {
};
struct TRTYMessageFormater {
static bool CheckLoggingContext(TLog& logger, const TLogRecordContext& context);
static TSimpleSharedPtr<TLogElement> StartRecord(TLog& logger, const TLogRecordContext& context, TSimpleSharedPtr<TLogElement> earlier);
};
using TRTYLogPreprocessor = TLogRecordPreprocessor<TLogFilter, TRTYMessageFormater>;
|