forked from sirjuddington/SLADE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLog.h
56 lines (42 loc) · 1.66 KB
/
Log.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
namespace Log
{
enum class MessageType
{
Info,
Warning,
Error,
Debug,
Console, // Only displayed in the console
Script, // Script output
Any
};
struct Message
{
string message;
MessageType type;
time_t timestamp;
string formattedMessageLine() const;
};
const vector<Message>& history();
int verbosity();
void setVerbosity(int verbosity);
void init();
void message(MessageType type, int level, const char* text);
void message(MessageType type, const char* text);
vector<Message*> since(time_t time, MessageType type = MessageType::Any);
inline void info(int level, const char* text) { message(MessageType::Info, level, text); }
inline void info(const char* text) { message(MessageType::Info, text); }
inline void warning(int level, const char* text) { message(MessageType::Warning, level, text); }
inline void warning(const char* text) { message(MessageType::Warning, text); }
inline void error(int level, const char* text) { message(MessageType::Error, level, text); }
inline void error(const char* text) { message(MessageType::Error, text); }
void debug(int level, const char* text);
void debug(const char* text);
inline void console(const char* text) { message(MessageType::Console, text); }
}
// Try to avoid using these and use Log::message/error/warning with S_FMT instead
#define LOG_MESSAGE(level, ...) Log::message(Log::MessageType::Info, level, wxString::Format(__VA_ARGS__))
#define LOG_WARNING(level, ...) Log::message(Log::MessageType::Warning, level, wxString::Format(__VA_ARGS__))
#define LOG_ERROR(level, ...) Log::message(Log::MessageType::Error, level, wxString::Format(__VA_ARGS__))
// move LOG_DEBUG here?