2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2009-03-07 01:35:01 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2009-03-07 01:35:01 -07:00
|
|
|
|
2010-12-14 10:52:01 -07:00
|
|
|
namespace LogTypes
|
|
|
|
{
|
2013-10-19 16:58:02 -06:00
|
|
|
enum LOG_TYPE
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
ACTIONREPLAY,
|
|
|
|
AUDIO,
|
|
|
|
AUDIO_INTERFACE,
|
|
|
|
BOOT,
|
|
|
|
COMMANDPROCESSOR,
|
|
|
|
COMMON,
|
|
|
|
CONSOLE,
|
2017-03-01 07:15:42 -07:00
|
|
|
CORE,
|
2016-06-24 02:43:46 -06:00
|
|
|
DISCIO,
|
|
|
|
DSPHLE,
|
|
|
|
DSPLLE,
|
|
|
|
DSP_MAIL,
|
|
|
|
DSPINTERFACE,
|
|
|
|
DVDINTERFACE,
|
|
|
|
DYNA_REC,
|
|
|
|
EXPANSIONINTERFACE,
|
|
|
|
FILEMON,
|
|
|
|
GDB_STUB,
|
|
|
|
GPFIFO,
|
|
|
|
HOST_GPU,
|
2017-01-18 12:38:44 -07:00
|
|
|
IOS,
|
|
|
|
IOS_DI,
|
|
|
|
IOS_ES,
|
|
|
|
IOS_FILEIO,
|
|
|
|
IOS_NET,
|
|
|
|
IOS_SD,
|
|
|
|
IOS_SSL,
|
|
|
|
IOS_STM,
|
2017-01-18 14:32:22 -07:00
|
|
|
IOS_USB,
|
2017-01-18 12:38:44 -07:00
|
|
|
IOS_WC24,
|
|
|
|
IOS_WIIMOTE,
|
2016-06-24 02:43:46 -06:00
|
|
|
MASTER_LOG,
|
|
|
|
MEMMAP,
|
|
|
|
MEMCARD_MANAGER,
|
|
|
|
NETPLAY,
|
|
|
|
OSHLE,
|
|
|
|
OSREPORT,
|
|
|
|
PAD,
|
|
|
|
PIXELENGINE,
|
|
|
|
PROCESSORINTERFACE,
|
|
|
|
POWERPC,
|
|
|
|
SERIALINTERFACE,
|
|
|
|
SP1,
|
|
|
|
VIDEO,
|
|
|
|
VIDEOINTERFACE,
|
|
|
|
WII_IPC,
|
|
|
|
WIIMOTE,
|
2009-03-18 11:17:58 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
NUMBER_OF_LOGS // Must be last
|
2009-03-07 01:35:01 -07:00
|
|
|
};
|
|
|
|
|
2013-10-19 16:58:02 -06:00
|
|
|
enum LOG_LEVELS
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
LNOTICE = 1, // VERY important information that is NOT errors. Like startup and OSReports.
|
|
|
|
LERROR = 2, // Critical errors
|
|
|
|
LWARNING = 3, // Something is suspicious.
|
|
|
|
LINFO = 4, // General information.
|
|
|
|
LDEBUG = 5, // Detailed debugging - might make things slow.
|
2009-03-07 01:35:01 -07:00
|
|
|
};
|
|
|
|
|
2014-02-07 18:23:34 -07:00
|
|
|
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
|
|
|
|
2010-12-14 10:52:01 -07:00
|
|
|
} // namespace
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
|
|
|
|
const char* fmt, ...)
|
2010-12-05 02:04:34 -07:00
|
|
|
#ifdef __GNUC__
|
2016-06-24 02:43:46 -06:00
|
|
|
__attribute__((format(printf, 5, 6)))
|
2010-12-05 02:04:34 -07:00
|
|
|
#endif
|
2016-06-24 02:43:46 -06:00
|
|
|
;
|
2009-03-07 01:35:01 -07:00
|
|
|
|
2009-03-18 11:17:58 -06:00
|
|
|
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
|
2014-08-21 18:11:52 -06:00
|
|
|
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LDEBUG
|
2009-03-07 01:35:01 -07:00
|
|
|
#else
|
2009-09-01 02:44:32 -06:00
|
|
|
#ifndef MAX_LOGLEVEL
|
2016-09-24 17:04:00 -06:00
|
|
|
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LINFO
|
2016-06-24 02:43:46 -06:00
|
|
|
#endif // loglevel
|
|
|
|
#endif // logging
|
2009-03-07 01:35:01 -07:00
|
|
|
|
|
|
|
// Let the compiler optimize this out
|
2016-06-24 02:43:46 -06:00
|
|
|
#define GENERIC_LOG(t, v, ...) \
|
|
|
|
{ \
|
|
|
|
if (v <= MAX_LOGLEVEL) \
|
|
|
|
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
|
|
|
|
}
|
2009-03-07 01:35:01 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
#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)
|