blob: bb3320d79508da9a8a5c6ca3a200a57b29242611 (
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
|
#pragma once
#include <util/generic/ptr.h>
#include <util/generic/string.h>
namespace NPersQueue {
class ILogger : public TAtomicRefCount<ILogger> {
public:
virtual ~ILogger() = default;
//level = syslog level
virtual void Log(const TString& msg, const TString& sourceId, const TString& sessionId, int level) = 0;
virtual bool IsEnabled(int level) const = 0;
};
class TCerrLogger : public ILogger {
public:
explicit TCerrLogger(int level)
: Level(level)
{
}
~TCerrLogger() override = default;
void Log(const TString& msg, const TString& sourceId, const TString& sessionId, int level) override;
bool IsEnabled(int level) const override
{
return level <= Level;
}
int GetLevel() const {
return Level;
}
private:
static TStringBuf LevelToString(int level);
private:
int Level;
};
}
|