aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common/log.h
diff options
context:
space:
mode:
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 4c96ef0a..c6a02355 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -1,108 +1,12 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
+// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
-#ifndef LOGGING
-#define LOGGING
-#endif
-
-enum {
- OS_LEVEL, // Printed by the emulated operating system
- NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports.
- ERROR_LEVEL, // Critical errors
- WARNING_LEVEL, // Something is suspicious.
- INFO_LEVEL, // General information.
- DEBUG_LEVEL, // Detailed debugging - might make things slow.
-};
-
-namespace LogTypes
-{
-
-enum LOG_TYPE {
- ACTIONREPLAY,
- AUDIO,
- AUDIO_INTERFACE,
- BOOT,
- COMMANDPROCESSOR,
- COMMON,
- CONSOLE,
- CONFIG,
- DISCIO,
- FILEMON,
- DSPHLE,
- DSPLLE,
- DSP_MAIL,
- DSPINTERFACE,
- DVDINTERFACE,
- DYNA_REC,
- EXPANSIONINTERFACE,
- GDB_STUB,
- ARM11,
- GSP,
- OSHLE,
- MASTER_LOG,
- MEMMAP,
- MEMCARD_MANAGER,
- OSREPORT,
- PAD,
- PROCESSORINTERFACE,
- PIXELENGINE,
- SERIALINTERFACE,
- SP1,
- STREAMINGINTERFACE,
- VIDEO,
- VIDEOINTERFACE,
- LOADER,
- FILESYS,
- WII_IPC_DVD,
- WII_IPC_ES,
- WII_IPC_FILEIO,
- WII_IPC_HID,
- KERNEL,
- SVC,
- NDMA,
- HLE,
- RENDER,
- GPU,
- HW,
- TIME,
- NETPLAY,
- GUI,
-
- NUMBER_OF_LOGS // Must be last
-};
-
-// FIXME: should this be removed?
-enum LOG_LEVELS {
- LOS = OS_LEVEL,
- LNOTICE = NOTICE_LEVEL,
- LERROR = ERROR_LEVEL,
- LWARNING = WARNING_LEVEL,
- LINFO = INFO_LEVEL,
- LDEBUG = DEBUG_LEVEL,
-};
-
-#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
-#define LOGTYPES_TYPE LogTypes::LOG_TYPE
-
-} // namespace
-
-void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line,
- const char* function, const char* fmt, ...)
-#ifdef __GNUC__
- __attribute__((format(printf, 6, 7)))
-#endif
- ;
-
-#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
-#define MAX_LOGLEVEL LDEBUG
-#else
-#ifndef MAX_LOGLEVEL
-#define MAX_LOGLEVEL LWARNING
-#endif // loglevel
-#endif // logging
+#include "common/common_funcs.h"
+#include "common/msg_handler.h"
+#include "common/logging/log.h"
#ifdef MSVC_VER
#ifndef __func__
@@ -110,29 +14,16 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
#endif
#endif
-// Let the compiler optimize this out
-#define GENERIC_LOG(t, v, ...) { \
- if (v <= LogTypes::MAX_LOGLEVEL) \
- GenericLog(v, t, __FILE__, __LINE__, __func__, __VA_ARGS__); \
- }
-
-#define OS_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LOS, __VA_ARGS__) } while (0)
-#define ERROR_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) } while (0)
-#define WARN_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) } while (0)
-#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } while (0)
-#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
-#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
-
-#if MAX_LOGLEVEL >= DEBUG_LEVEL
+#if _DEBUG
#define _dbg_assert_(_t_, _a_) \
if (!(_a_)) {\
- ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
+ LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__); \
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
}
#define _dbg_assert_msg_(_t_, _a_, ...)\
if (!(_a_)) {\
- ERROR_LOG(_t_, __VA_ARGS__); \
+ LOG_CRITICAL(_t_, __VA_ARGS__); \
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
}
#define _dbg_update_() Host_UpdateLogDisplay();
@@ -144,12 +35,12 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
#define _dbg_assert_(_t_, _a_) {}
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {}
#endif // dbg_assert
-#endif // MAX_LOGLEVEL DEBUG
+#endif
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
#ifndef GEKKO
-#ifdef MSVC_VER
+#ifdef _WIN32
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
@@ -159,7 +50,7 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
}
-#endif // MSVC_VER
+#endif // _WIN32
#else // GEKKO
#define _assert_msg_(_t_, _a_, _fmt_, ...)
-#endif
+#endif \ No newline at end of file