Files
dolphin/Source/Core/Common/Logging/Log.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

124 lines
4.2 KiB
C++
Raw Normal View History

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