First pass at dealing with different size_t/off_t sizes in C90 environments.

Most of the code dealing with the LogTypes namespace was C which lead to a
lot of nonsensical casting, so I have dumbed LOG_TYPE and LOG_LEVEL down to
plain C even though the move of wiiuse into Source means we don't currently
call GenericLog from C.

Set logging threshold to MAX_LOGLEVEL at startup so debug builds will also
p  rint debugging messages before the GUI is running.

For some reason the way we use SetDefaultStyle doesn't play nice with wx 2.9
so we just get the default black text on a black background. Using a gray
background works around that problem, but I found it to also be much easier
on the eyes so I have switched the background color on all versions.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6528 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang
2010-12-05 15:59:11 +00:00
parent e5311460a9
commit f169def36f
49 changed files with 1877 additions and 1888 deletions

View File

@ -18,17 +18,6 @@
#ifndef _LOG_H_
#define _LOG_H_
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports.
#define ERROR_LEVEL 2 // Critical errors
#define WARNING_LEVEL 3 // Something is suspicious.
#define INFO_LEVEL 4 // General information.
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
#ifdef __cplusplus
namespace LogTypes
{
#endif
enum LOG_TYPE {
ACTIONREPLAY,
AUDIO,
@ -48,7 +37,7 @@ enum LOG_TYPE {
EXPANSIONINTERFACE,
POWERPC,
GPFIFO,
HLE,
OSHLE,
MASTER_LOG,
MEMMAP,
MEMCARD_MANAGER,
@ -77,37 +66,21 @@ enum LOG_TYPE {
NUMBER_OF_LOGS // Must be last
};
// FIXME: should this be removed?
enum LOG_LEVELS {
LNOTICE = NOTICE_LEVEL,
LERROR = ERROR_LEVEL,
LWARNING = WARNING_LEVEL,
LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL,
enum LOG_LEVEL {
NOTICE_LEVEL = 1, // VERY important information that is NOT errors. Like startup and OSReports
ERROR_LEVEL = 2, // Critical errors
WARNING_LEVEL = 3, // Something is suspicious
INFO_LEVEL = 4, // General information
DEBUG_LEVEL = 5, // Detailed debugging - might make things slow
};
#ifdef __cplusplus
#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
#define LOGTYPES_TYPE LogTypes::LOG_TYPE
#else
#define LOGTYPES_LEVELS enum LOG_LEVELS
#define LOGTYPES_TYPE enum LOG_TYPE
#endif
#ifdef __cplusplus
} // namespace
extern "C" {
#endif
void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
extern "C"
void GenericLog(enum LOG_LEVEL level, enum LOG_TYPE type,
const char *file, int line, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 5, 6)))
#endif
;
#ifdef __cplusplus
};
#endif
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
#define MAX_LOGLEVEL DEBUG_LEVEL
@ -120,16 +93,20 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
#ifdef GEKKO
#define GENERIC_LOG(t, v, ...)
#else
// Let the compiler optimize this out
#define GENERIC_LOG(t, v, ...) {if (v <= MAX_LOGLEVEL) {GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__);}}
#define GENERIC_LOG(t, v, ...) { \
if (v <= MAX_LOGLEVEL) \
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
}
//#define GENERIC_LOG(t, v, ...) { if (v <= MAX_LOGLEVEL)
// GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); }
#endif
#define ERROR_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) }
#define WARN_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) }
#define NOTICE_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) }
#define INFO_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) }
#define DEBUG_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) }
#define ERROR_LOG(t,...) { GENERIC_LOG(t, ERROR_LEVEL, __VA_ARGS__) }
#define WARN_LOG(t,...) { GENERIC_LOG(t, WARNING_LEVEL, __VA_ARGS__) }
#define NOTICE_LOG(t,...) { GENERIC_LOG(t, NOTICE_LEVEL, __VA_ARGS__) }
#define INFO_LOG(t,...) { GENERIC_LOG(t, INFO_LEVEL, __VA_ARGS__) }
#define DEBUG_LOG(t,...) { GENERIC_LOG(t, DEBUG_LEVEL, __VA_ARGS__) }
#if MAX_LOGLEVEL >= DEBUG_LEVEL
#define _dbg_assert_(_t_, _a_) \