-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathLogLevel.cpp
More file actions
38 lines (28 loc) · 772 Bytes
/
LogLevel.cpp
File metadata and controls
38 lines (28 loc) · 772 Bytes
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
//
// Created by Pavel Akhtyamov on 2019-04-09.
//
#include "LogLevel.h"
constexpr LogLevel::LogLevel(LogLevel::Value log_level_): value_(log_level_) {}
bool LogLevel::operator ==(const LogLevel& a) const {
return value_ == a.value_;
}
std::initializer_list<LogLevel> LogLevel::All() {
return {
LogLevel::INFO,
LogLevel::ERROR,
LogLevel::DEBUG,
LogLevel::WARNING
};
}
size_t LogLevel::GetValue() const {
return value_;
}
std::ostream& operator << (std::ostream& ostream, const LogLevel& level) {
std::unordered_map<LogLevel, std::string> strings {
{LogLevel::INFO, "INFO"},
{LogLevel::DEBUG, "DEBUG"},
{LogLevel::WARNING, "WARNING"},
{LogLevel::ERROR, "ERROR"}
};
return ostream << strings[level];
}