summaryrefslogtreecommitdiff
path: root/src/common/log.h
diff options
context:
space:
mode:
authorGravatar darkf2014-12-29 19:47:41 -0800
committerGravatar darkf2014-12-29 19:47:41 -0800
commit8ba9ac0f74abb0408a26207a76a0c1808bad8de0 (patch)
treef1c7c3393fa726435b5b90bf335567c93e528ef1 /src/common/log.h
parentAdd comment regarding __WIN32__ in SkyEye code (diff)
parentMerge pull request #367 from bunnei/usat_ssat (diff)
downloadyuzu-8ba9ac0f74abb0408a26207a76a0c1808bad8de0.tar.gz
yuzu-8ba9ac0f74abb0408a26207a76a0c1808bad8de0.tar.xz
yuzu-8ba9ac0f74abb0408a26207a76a0c1808bad8de0.zip
Fix merge conflicts
Diffstat (limited to 'src/common/log.h')
-rw-r--r--src/common/log.h133
1 files changed, 12 insertions, 121 deletions
diff --git a/src/common/log.h b/src/common/log.h
index 4c96ef0a6..c6a023552 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -1,108 +1,12 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#pragma once 5#pragma once
6 6
7#ifndef LOGGING 7#include "common/common_funcs.h"
8#define LOGGING 8#include "common/msg_handler.h"
9#endif 9#include "common/logging/log.h"
10
11enum {
12 OS_LEVEL, // Printed by the emulated operating system
13 NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports.
14 ERROR_LEVEL, // Critical errors
15 WARNING_LEVEL, // Something is suspicious.
16 INFO_LEVEL, // General information.
17 DEBUG_LEVEL, // Detailed debugging - might make things slow.
18};
19
20namespace LogTypes
21{
22
23enum LOG_TYPE {
24 ACTIONREPLAY,
25 AUDIO,
26 AUDIO_INTERFACE,
27 BOOT,
28 COMMANDPROCESSOR,
29 COMMON,
30 CONSOLE,
31 CONFIG,
32 DISCIO,
33 FILEMON,
34 DSPHLE,
35 DSPLLE,
36 DSP_MAIL,
37 DSPINTERFACE,
38 DVDINTERFACE,
39 DYNA_REC,
40 EXPANSIONINTERFACE,
41 GDB_STUB,
42 ARM11,
43 GSP,
44 OSHLE,
45 MASTER_LOG,
46 MEMMAP,
47 MEMCARD_MANAGER,
48 OSREPORT,
49 PAD,
50 PROCESSORINTERFACE,
51 PIXELENGINE,
52 SERIALINTERFACE,
53 SP1,
54 STREAMINGINTERFACE,
55 VIDEO,
56 VIDEOINTERFACE,
57 LOADER,
58 FILESYS,
59 WII_IPC_DVD,
60 WII_IPC_ES,
61 WII_IPC_FILEIO,
62 WII_IPC_HID,
63 KERNEL,
64 SVC,
65 NDMA,
66 HLE,
67 RENDER,
68 GPU,
69 HW,
70 TIME,
71 NETPLAY,
72 GUI,
73
74 NUMBER_OF_LOGS // Must be last
75};
76
77// FIXME: should this be removed?
78enum LOG_LEVELS {
79 LOS = OS_LEVEL,
80 LNOTICE = NOTICE_LEVEL,
81 LERROR = ERROR_LEVEL,
82 LWARNING = WARNING_LEVEL,
83 LINFO = INFO_LEVEL,
84 LDEBUG = DEBUG_LEVEL,
85};
86
87#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
88#define LOGTYPES_TYPE LogTypes::LOG_TYPE
89
90} // namespace
91
92void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line,
93 const char* function, const char* fmt, ...)
94#ifdef __GNUC__
95 __attribute__((format(printf, 6, 7)))
96#endif
97 ;
98
99#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
100#define MAX_LOGLEVEL LDEBUG
101#else
102#ifndef MAX_LOGLEVEL
103#define MAX_LOGLEVEL LWARNING
104#endif // loglevel
105#endif // logging
106 10
107#ifdef MSVC_VER 11#ifdef MSVC_VER
108#ifndef __func__ 12#ifndef __func__
@@ -110,29 +14,16 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
110#endif 14#endif
111#endif 15#endif
112 16
113// Let the compiler optimize this out 17#if _DEBUG
114#define GENERIC_LOG(t, v, ...) { \
115 if (v <= LogTypes::MAX_LOGLEVEL) \
116 GenericLog(v, t, __FILE__, __LINE__, __func__, __VA_ARGS__); \
117 }
118
119#define OS_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LOS, __VA_ARGS__) } while (0)
120#define ERROR_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) } while (0)
121#define WARN_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) } while (0)
122#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } while (0)
123#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
124#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
125
126#if MAX_LOGLEVEL >= DEBUG_LEVEL
127#define _dbg_assert_(_t_, _a_) \ 18#define _dbg_assert_(_t_, _a_) \
128 if (!(_a_)) {\ 19 if (!(_a_)) {\
129 ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ 20 LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
130 __LINE__, __FILE__, __TIME__); \ 21 __LINE__, __FILE__, __TIME__); \
131 if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \ 22 if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
132 } 23 }
133#define _dbg_assert_msg_(_t_, _a_, ...)\ 24#define _dbg_assert_msg_(_t_, _a_, ...)\
134 if (!(_a_)) {\ 25 if (!(_a_)) {\
135 ERROR_LOG(_t_, __VA_ARGS__); \ 26 LOG_CRITICAL(_t_, __VA_ARGS__); \
136 if (!PanicYesNo(__VA_ARGS__)) {Crash();} \ 27 if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
137 } 28 }
138#define _dbg_update_() Host_UpdateLogDisplay(); 29#define _dbg_update_() Host_UpdateLogDisplay();
@@ -144,12 +35,12 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
144#define _dbg_assert_(_t_, _a_) {} 35#define _dbg_assert_(_t_, _a_) {}
145#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {} 36#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {}
146#endif // dbg_assert 37#endif // dbg_assert
147#endif // MAX_LOGLEVEL DEBUG 38#endif
148 39
149#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) 40#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
150 41
151#ifndef GEKKO 42#ifndef GEKKO
152#ifdef MSVC_VER 43#ifdef _WIN32
153#define _assert_msg_(_t_, _a_, _fmt_, ...) \ 44#define _assert_msg_(_t_, _a_, _fmt_, ...) \
154 if (!(_a_)) {\ 45 if (!(_a_)) {\
155 if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \ 46 if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
@@ -159,7 +50,7 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
159 if (!(_a_)) {\ 50 if (!(_a_)) {\
160 if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \ 51 if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
161 } 52 }
162#endif // MSVC_VER 53#endif // _WIN32
163#else // GEKKO 54#else // GEKKO
164#define _assert_msg_(_t_, _a_, _fmt_, ...) 55#define _assert_msg_(_t_, _a_, _fmt_, ...)
165#endif 56#endif \ No newline at end of file