summaryrefslogtreecommitdiff
path: root/src/common/log.h
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-29 23:03:03 -0400
committerGravatar bunnei2014-05-29 23:03:03 -0400
commit6fc62f8c93bd81f6207fcbdfe332b4e56c2aa2be (patch)
treed6a66ca0fdd3f6e2ff66cf1f88283107d525c0c7 /src/common/log.h
parentcore: changed time delay before kernel reschedule to "approximate" a screen r... (diff)
downloadyuzu-6fc62f8c93bd81f6207fcbdfe332b4e56c2aa2be.tar.gz
yuzu-6fc62f8c93bd81f6207fcbdfe332b4e56c2aa2be.tar.xz
yuzu-6fc62f8c93bd81f6207fcbdfe332b4e56c2aa2be.zip
log: fixed to not print twice, enabled coloring, added OS print logging as its own type
Diffstat (limited to 'src/common/log.h')
-rw-r--r--src/common/log.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/common/log.h b/src/common/log.h
index 8b39b03a1..2543b51a8 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -7,11 +7,14 @@
7 7
8#define LOGGING 8#define LOGGING
9 9
10#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports. 10enum {
11#define ERROR_LEVEL 2 // Critical errors 11 OS_LEVEL, // Printed by the emulated operating system
12#define WARNING_LEVEL 3 // Something is suspicious. 12 NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports.
13#define INFO_LEVEL 4 // General information. 13 ERROR_LEVEL, // Critical errors
14#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow. 14 WARNING_LEVEL, // Something is suspicious.
15 INFO_LEVEL, // General information.
16 DEBUG_LEVEL, // Detailed debugging - might make things slow.
17};
15 18
16namespace LogTypes 19namespace LogTypes
17{ 20{
@@ -70,6 +73,7 @@ enum LOG_TYPE {
70 73
71// FIXME: should this be removed? 74// FIXME: should this be removed?
72enum LOG_LEVELS { 75enum LOG_LEVELS {
76 LOS = OS_LEVEL,
73 LNOTICE = NOTICE_LEVEL, 77 LNOTICE = NOTICE_LEVEL,
74 LERROR = ERROR_LEVEL, 78 LERROR = ERROR_LEVEL,
75 LWARNING = WARNING_LEVEL, 79 LWARNING = WARNING_LEVEL,
@@ -82,8 +86,8 @@ enum LOG_LEVELS {
82 86
83} // namespace 87} // namespace
84 88
85void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, 89void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line,
86 const char *file, int line, const char *fmt, ...) 90 const char* function, const char* fmt, ...)
87#ifdef __GNUC__ 91#ifdef __GNUC__
88 __attribute__((format(printf, 5, 6))) 92 __attribute__((format(printf, 5, 6)))
89#endif 93#endif
@@ -97,16 +101,19 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
97#endif // loglevel 101#endif // loglevel
98#endif // logging 102#endif // logging
99 103
100#ifdef GEKKO 104#ifdef _WIN32
101#define GENERIC_LOG(t, v, ...) 105#ifndef __func__
102#else 106#define __func__ __FUNCTION__
107#endif
108#endif
109
103// Let the compiler optimize this out 110// Let the compiler optimize this out
104#define GENERIC_LOG(t, v, ...) { \ 111#define GENERIC_LOG(t, v, ...) { \
105 if (v <= MAX_LOGLEVEL) \ 112 if (v <= MAX_LOGLEVEL) \
106 GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \ 113 GenericLog(v, t, __FILE__, __LINE__, __func__, __VA_ARGS__); \
107 } 114 }
108#endif
109 115
116#define OS_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LOS, __VA_ARGS__) } while (0)
110#define ERROR_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) } while (0) 117#define ERROR_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) } while (0)
111#define WARN_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) } while (0) 118#define WARN_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) } while (0)
112#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } while (0) 119#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } while (0)