summaryrefslogtreecommitdiff
path: root/src/common/log.h
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-14 12:13:16 -0400
committerGravatar bunnei2014-06-14 12:13:16 -0400
commit004df767953a949817da89bddcd5d1379240f769 (patch)
treeb2d54928dcbf3cb4dde0cd5d3277afe7999b7bd9 /src/common/log.h
parentGPU debugger: Const correctness and build fix. (diff)
parentKernel: Removed unnecessary "#pragma once". (diff)
downloadyuzu-004df767953a949817da89bddcd5d1379240f769.tar.gz
yuzu-004df767953a949817da89bddcd5d1379240f769.tar.xz
yuzu-004df767953a949817da89bddcd5d1379240f769.zip
Merge branch 'threading' of https://github.com/bunnei/citra
Conflicts: src/core/hle/function_wrappers.h src/core/hle/service/gsp.cpp
Diffstat (limited to 'src/common/log.h')
-rw-r--r--src/common/log.h39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/common/log.h b/src/common/log.h
index d0da68aad..e923224ed 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,31 +86,34 @@ 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, 6, 7)))
89#endif 93#endif
90 ; 94 ;
91 95
92#if defined LOGGING || defined _DEBUG || defined DEBUGFAST 96#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
93#define MAX_LOGLEVEL DEBUG_LEVEL 97#define MAX_LOGLEVEL LDEBUG
94#else 98#else
95#ifndef MAX_LOGLEVEL 99#ifndef MAX_LOGLEVEL
96#define MAX_LOGLEVEL WARNING_LEVEL 100#define MAX_LOGLEVEL LWARNING
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 <= LogTypes::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)