mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Add command line flag to set log level to debug. Cleanup.
This commit is contained in:
1 parent
581872f2d0
commit
63beeb5030
3 files changed
+50
-51
No files matched your search
+30
-42
@@ -15,11 +15,10 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _LOG_H_
|
||||
#define _LOG_H_
|
||||
#pragma once
|
||||
|
||||
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports.
|
||||
#define ERROR_LEVEL 2 // Critical errors
|
||||
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and debugprintfs from the game itself.
|
||||
#define ERROR_LEVEL 2 // Important errors.
|
||||
#define WARNING_LEVEL 3 // Something is suspicious.
|
||||
#define INFO_LEVEL 4 // General information.
|
||||
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
|
||||
@@ -28,28 +27,28 @@ namespace LogTypes
|
||||
{
|
||||
|
||||
enum LOG_TYPE {
|
||||
MASTER_LOG,
|
||||
BOOT,
|
||||
COMMON,
|
||||
CPU,
|
||||
LOADER,
|
||||
IO,
|
||||
PAD,
|
||||
FILESYS,
|
||||
DISCIO,
|
||||
G3D,
|
||||
DMA,
|
||||
INTC,
|
||||
MEMMAP,
|
||||
SOUND,
|
||||
HLE,
|
||||
TIMER,
|
||||
VIDEO,
|
||||
DYNA_REC,
|
||||
NETPLAY,
|
||||
MASTER_LOG,
|
||||
BOOT,
|
||||
COMMON,
|
||||
CPU,
|
||||
LOADER,
|
||||
IO,
|
||||
PAD,
|
||||
FILESYS,
|
||||
DISCIO,
|
||||
G3D,
|
||||
DMA,
|
||||
INTC,
|
||||
MEMMAP,
|
||||
SOUND,
|
||||
HLE,
|
||||
TIMER,
|
||||
VIDEO,
|
||||
DYNA_REC,
|
||||
NETPLAY,
|
||||
|
||||
NUMBER_OF_LOGS, // Must be last
|
||||
JIT = DYNA_REC,
|
||||
NUMBER_OF_LOGS, // Must be last
|
||||
JIT = DYNA_REC,
|
||||
};
|
||||
|
||||
// FIXME: should this be removed?
|
||||
@@ -73,30 +72,25 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
|
||||
#endif
|
||||
;
|
||||
|
||||
#if defined(LOGGING) || defined(_DEBUG) || defined(DEBUGFAST) // || defined(ANDROID) //|| defined(__APPLE__)//
|
||||
#if defined(LOGGING) || defined(_DEBUG) || defined(DEBUGFAST)
|
||||
#define MAX_LOGLEVEL DEBUG_LEVEL
|
||||
#else
|
||||
#ifndef MAX_LOGLEVEL
|
||||
#define MAX_LOGLEVEL INFO_LEVEL
|
||||
//#define MAX_LOGLEVEL NOTICE_LEVEL
|
||||
#endif // loglevel
|
||||
#endif // logging
|
||||
|
||||
#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__); \
|
||||
}
|
||||
#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 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 INFO_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) }
|
||||
#define DEBUG_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) }
|
||||
|
||||
#if MAX_LOGLEVEL >= DEBUG_LEVEL
|
||||
#define _dbg_assert_(_t_, _a_) \
|
||||
@@ -123,8 +117,7 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
|
||||
|
||||
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
||||
|
||||
#ifndef GEKKO
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||
if (!(_a_)) {\
|
||||
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
|
||||
@@ -135,8 +128,3 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
|
||||
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#endif // WIN32
|
||||
#else // GEKKO
|
||||
#define _assert_msg_(_t_, _a_, _fmt_, ...)
|
||||
#endif
|
||||
|
||||
#endif // _LOG_H_
|
||||
@@ -23,6 +23,7 @@ add_definitions(-DSDL)
|
||||
add_definitions(-Wno-multichar)
|
||||
add_definitions(-fno-strict-aliasing)
|
||||
add_definitions(-DUSE_PROFILER)
|
||||
add_definitions(-D_DEBUG)
|
||||
|
||||
if (UNIX)
|
||||
if (NOT APPLE) # can't build the SDL .m file with -std=gnu++0x
|
||||
|
||||
@@ -163,14 +163,23 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
LogManager *logman = LogManager::GetInstance();
|
||||
ILOG("Logman: %p", logman);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
boot_filename = argv[1];
|
||||
|
||||
if (!File::Exists(boot_filename))
|
||||
{
|
||||
fprintf(stdout, "File not found: %s\n", boot_filename.c_str());
|
||||
exit(1);
|
||||
// Parse command line
|
||||
LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
switch (argv[i][1]) {
|
||||
case 'd':
|
||||
// Enable debug logging
|
||||
logLevel = LogTypes::LDEBUG;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
boot_filename = argv[i];
|
||||
if (!File::Exists(boot_filename))
|
||||
{
|
||||
fprintf(stdout, "File not found: %s\n", boot_filename.c_str());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,11 +199,12 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
{
|
||||
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
|
||||
logman->SetEnable(type, true);
|
||||
logman->SetLogLevel(type, LogTypes::LDEBUG);
|
||||
logman->SetLogLevel(type, logLevel);
|
||||
#ifdef ANDROID
|
||||
logman->AddListener(type, logger);
|
||||
#endif
|
||||
}
|
||||
// Special hack for G3D as it's very spammy. Need to make a flag for this.
|
||||
logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
|
||||
INFO_LOG(BOOT, "Logger inited.");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user