2015-05-24 07:55:12 +03:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-18 02:08:10 +03:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 06:09:55 +03:00
|
|
|
// Refer to the license.txt file included.
|
2009-03-07 10:35:01 +02:00
|
|
|
|
2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2009-03-07 10:35:01 +02:00
|
|
|
|
2019-11-28 11:19:24 +02:00
|
|
|
namespace Common::Log
|
2010-12-14 19:52:01 +02:00
|
|
|
{
|
2013-10-20 01:58:02 +03:00
|
|
|
enum LOG_TYPE
|
|
|
|
{
|
2009-03-07 10:35:01 +02:00
|
|
|
ACTIONREPLAY,
|
|
|
|
AUDIO,
|
|
|
|
AUDIO_INTERFACE,
|
|
|
|
BOOT,
|
|
|
|
COMMANDPROCESSOR,
|
|
|
|
COMMON,
|
|
|
|
CONSOLE,
|
2017-03-01 16:15:42 +02:00
|
|
|
CORE,
|
2009-03-07 10:35:01 +02:00
|
|
|
DISCIO,
|
|
|
|
DSPHLE,
|
2009-04-06 20:12:05 +03:00
|
|
|
DSPLLE,
|
2009-07-18 04:16:17 +03:00
|
|
|
DSP_MAIL,
|
2009-03-07 10:35:01 +02:00
|
|
|
DSPINTERFACE,
|
|
|
|
DVDINTERFACE,
|
|
|
|
DYNA_REC,
|
|
|
|
EXPANSIONINTERFACE,
|
2015-09-10 09:28:44 +03:00
|
|
|
FILEMON,
|
2013-01-06 12:28:27 +02:00
|
|
|
GDB_STUB,
|
2009-03-07 10:35:01 +02:00
|
|
|
GPFIFO,
|
2015-09-10 09:28:44 +03:00
|
|
|
HOST_GPU,
|
2017-01-18 21:38:44 +02:00
|
|
|
IOS,
|
|
|
|
IOS_DI,
|
|
|
|
IOS_ES,
|
2018-03-03 19:55:01 +02:00
|
|
|
IOS_FS,
|
2017-01-18 21:38:44 +02:00
|
|
|
IOS_NET,
|
|
|
|
IOS_SD,
|
|
|
|
IOS_SSL,
|
|
|
|
IOS_STM,
|
2017-01-18 23:32:22 +02:00
|
|
|
IOS_USB,
|
2017-01-18 21:38:44 +02:00
|
|
|
IOS_WC24,
|
2017-08-16 23:24:24 +03:00
|
|
|
IOS_WFS,
|
2017-01-18 21:38:44 +02:00
|
|
|
IOS_WIIMOTE,
|
2009-03-07 10:35:01 +02:00
|
|
|
MASTER_LOG,
|
|
|
|
MEMMAP,
|
2009-07-18 04:16:17 +03:00
|
|
|
MEMCARD_MANAGER,
|
2015-09-10 09:28:44 +03:00
|
|
|
NETPLAY,
|
|
|
|
OSHLE,
|
2009-03-07 10:35:01 +02:00
|
|
|
OSREPORT,
|
2013-10-29 07:23:17 +02:00
|
|
|
PAD,
|
2009-03-07 10:35:01 +02:00
|
|
|
PIXELENGINE,
|
2015-09-10 09:28:44 +03:00
|
|
|
PROCESSORINTERFACE,
|
|
|
|
POWERPC,
|
2009-03-07 10:35:01 +02:00
|
|
|
SERIALINTERFACE,
|
2009-05-04 22:28:53 +03:00
|
|
|
SP1,
|
2018-03-22 09:18:25 +02:00
|
|
|
SYMBOLS,
|
2009-03-07 10:35:01 +02:00
|
|
|
VIDEO,
|
|
|
|
VIDEOINTERFACE,
|
|
|
|
WII_IPC,
|
2009-03-18 19:17:58 +02:00
|
|
|
WIIMOTE,
|
|
|
|
|
2009-03-07 10:35:01 +02:00
|
|
|
NUMBER_OF_LOGS // Must be last
|
|
|
|
};
|
|
|
|
|
2013-10-20 01:58:02 +03:00
|
|
|
enum LOG_LEVELS
|
|
|
|
{
|
2014-08-22 03:11:52 +03: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 10:35:01 +02:00
|
|
|
};
|
|
|
|
|
2014-02-08 03:23:34 +02:00
|
|
|
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
|
|
|
|
2019-11-28 11:19:24 +02:00
|
|
|
void GenericLog(Common::Log::LOG_LEVELS level, Common::Log::LOG_TYPE type, const char* file,
|
|
|
|
int line, const char* fmt, ...)
|
2010-12-05 11:04:34 +02:00
|
|
|
#ifdef __GNUC__
|
|
|
|
__attribute__((format(printf, 5, 6)))
|
|
|
|
#endif
|
|
|
|
;
|
2019-11-28 11:19:24 +02:00
|
|
|
} // namespace Common::Log
|
2009-03-07 10:35:01 +02:00
|
|
|
|
2018-05-28 04:26:47 +03:00
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
2019-11-28 11:19:24 +02:00
|
|
|
#define MAX_LOGLEVEL Common::Log::LOG_LEVELS::LDEBUG
|
2009-03-07 10:35:01 +02:00
|
|
|
#else
|
2009-09-01 11:44:32 +03:00
|
|
|
#ifndef MAX_LOGLEVEL
|
2019-11-28 11:19:24 +02:00
|
|
|
#define MAX_LOGLEVEL Common::Log::LOG_LEVELS::LINFO
|
2009-09-01 11:44:32 +03:00
|
|
|
#endif // loglevel
|
2009-03-07 10:35:01 +02:00
|
|
|
#endif // logging
|
|
|
|
|
|
|
|
// Let the compiler optimize this out
|
2010-12-05 17:59:11 +02:00
|
|
|
#define GENERIC_LOG(t, v, ...) \
|
2018-04-16 19:08:16 +03:00
|
|
|
do \
|
2010-12-05 17:59:11 +02:00
|
|
|
{ \
|
|
|
|
if (v <= MAX_LOGLEVEL) \
|
2019-11-28 11:19:24 +02:00
|
|
|
Common::Log::GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
|
2018-04-16 19:08:16 +03:00
|
|
|
} while (0)
|
2009-03-07 10:35:01 +02:00
|
|
|
|
2012-08-20 14:12:49 +03:00
|
|
|
#define ERROR_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
2019-11-28 11:19:24 +02:00
|
|
|
GENERIC_LOG(Common::Log::t, Common::Log::LERROR, __VA_ARGS__); \
|
2012-08-20 14:12:49 +03:00
|
|
|
} while (0)
|
|
|
|
#define WARN_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
2019-11-28 11:19:24 +02:00
|
|
|
GENERIC_LOG(Common::Log::t, Common::Log::LWARNING, __VA_ARGS__); \
|
2012-08-20 14:12:49 +03:00
|
|
|
} while (0)
|
|
|
|
#define NOTICE_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
2019-11-28 11:19:24 +02:00
|
|
|
GENERIC_LOG(Common::Log::t, Common::Log::LNOTICE, __VA_ARGS__); \
|
2012-08-20 14:12:49 +03:00
|
|
|
} while (0)
|
|
|
|
#define INFO_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
2019-11-28 11:19:24 +02:00
|
|
|
GENERIC_LOG(Common::Log::t, Common::Log::LINFO, __VA_ARGS__); \
|
2012-08-20 14:12:49 +03:00
|
|
|
} while (0)
|
|
|
|
#define DEBUG_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
2019-11-28 11:19:24 +02:00
|
|
|
GENERIC_LOG(Common::Log::t, Common::Log::LDEBUG, __VA_ARGS__); \
|
2012-08-20 14:12:49 +03:00
|
|
|
} while (0)
|