-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathLogger.h
42 lines (33 loc) · 856 Bytes
/
Logger.h
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
#ifndef LOGGER_H
#define LOGGER_H
#include <string>
#include <cstdarg>
namespace npu_logging {
enum class LoggingLevel {
DEBUG = 10,
INFO = 20,
WARNING = 30,
ERROR = 40,
CRITICAL = 50
};
class Logger {
public:
Logger() = default;
Logger(const std::string &name) : name_(name) {};
~Logger() = default;
void setAllowLevel(LoggingLevel level);
void setQName(const std::string& qname);
std::string getQName();
void debug(const char* format, ...);
void info(const char* format, ...);
void warn(const char* format, ...);
void error(const char* format, ...);
void critical(const char* format, ...);
private:
void log(LoggingLevel level, const char* format, va_list args);
LoggingLevel allow_level_ = LoggingLevel::WARNING;
std::string name_;
std::string qname_;
};
}
#endif