mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Common: Unify logging namespace with Common
Previously the logging was a in a little bit of a disarray. Some things were in namespaces, and other things were not. Given this code will feature a bit of restructuring during the transition over to fmt, this is a good time to unify it under a single namespace and also remove functions and types from the global namespace. Now, all functions and types are under the Common::Log namespace. The only outliers being, of course, the preprocessor macros.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace LogTypes
|
||||
namespace Common::Log
|
||||
{
|
||||
enum LOG_TYPE
|
||||
{
|
||||
@ -72,20 +72,19 @@ enum LOG_LEVELS
|
||||
|
||||
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
||||
|
||||
} // namespace LogTypes
|
||||
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
|
||||
const char* fmt, ...)
|
||||
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
|
||||
;
|
||||
} // namespace Common::Log
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LDEBUG
|
||||
#define MAX_LOGLEVEL Common::Log::LOG_LEVELS::LDEBUG
|
||||
#else
|
||||
#ifndef MAX_LOGLEVEL
|
||||
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LINFO
|
||||
#define MAX_LOGLEVEL Common::Log::LOG_LEVELS::LINFO
|
||||
#endif // loglevel
|
||||
#endif // logging
|
||||
|
||||
@ -94,31 +93,31 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char*
|
||||
do \
|
||||
{ \
|
||||
if (v <= MAX_LOGLEVEL) \
|
||||
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
|
||||
Common::Log::GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define ERROR_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LERROR, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define WARN_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LWARNING, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define NOTICE_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LNOTICE, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define INFO_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LINFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define DEBUG_LOG(t, ...) \
|
||||
do \
|
||||
{ \
|
||||
GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__); \
|
||||
GENERIC_LOG(Common::Log::t, Common::Log::LDEBUG, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
Reference in New Issue
Block a user