-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLogger.hpp
More file actions
37 lines (30 loc) · 826 Bytes
/
Logger.hpp
File metadata and controls
37 lines (30 loc) · 826 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
#pragma once
#include <string>
/// 日志输出
class Logger {
public:
/// 是否输出到控制台,否则使用 OutputDebugString WinAPI
static bool CONSOLE;
enum OutputLevel {
OL_INFO, ///< 输出普通信息与错误信息
OL_ERROR, ///< 只输出错误信息
};
static OutputLevel LEVEL;
/// 输出日志
///
/// 级别由参数 @a level 提供
static void Log(const char *msg, OutputLevel level);
static void Log(const std::string &msg, OutputLevel level) {
Log(msg.c_str(), level);
}
/// 输出普通信息
static void LogInfo(const char *msg);
static void LogInfo(const std::string &msg) {
LogInfo(msg.c_str());
}
/// 输出错误信息
static void LogError(const char *msg);
static void LogError(const std::string &msg) {
LogError(msg.c_str());
}
};