mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
c792961000
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.
70 lines
4.8 KiB
C
70 lines
4.8 KiB
C
// Copyright 2015 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include "Common/Common.h"
|
|
#include "Common/CommonFuncs.h"
|
|
#include "Common/Logging/Log.h"
|
|
#include "Common/MsgHandler.h"
|
|
|
|
#ifdef _WIN32
|
|
#define ASSERT_MSG(_t_, _a_, _fmt_, ...) \
|
|
do \
|
|
{ \
|
|
if (!(_a_)) \
|
|
{ \
|
|
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
|
|
Crash(); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
|
do \
|
|
{ \
|
|
if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG && !(_a_)) \
|
|
{ \
|
|
ERROR_LOG(_t_, _msg_, __VA_ARGS__); \
|
|
if (!PanicYesNo(_msg_, __VA_ARGS__)) \
|
|
Crash(); \
|
|
} \
|
|
} while (0)
|
|
#else
|
|
#define ASSERT_MSG(_t_, _a_, _fmt_, ...) \
|
|
do \
|
|
{ \
|
|
if (!(_a_)) \
|
|
{ \
|
|
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
|
|
Crash(); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
|
do \
|
|
{ \
|
|
if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG && !(_a_)) \
|
|
{ \
|
|
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
|
|
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
|
|
Crash(); \
|
|
} \
|
|
} while (0)
|
|
#endif
|
|
|
|
#define ASSERT(_a_) \
|
|
do \
|
|
{ \
|
|
ASSERT_MSG(MASTER_LOG, _a_, \
|
|
_trans("An error occurred.\n\n Line: %d\n File: %s\n\nIgnore and continue?"), \
|
|
__LINE__, __FILE__); \
|
|
} while (0)
|
|
|
|
#define DEBUG_ASSERT(_a_) \
|
|
do \
|
|
{ \
|
|
if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
|
ASSERT(_a_); \
|
|
} while (0)
|