yuzu-fork/src/common/log.h

53 lines
1.3 KiB
C
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include "common/common_funcs.h"
#include "common/msg_handler.h"
2014-10-28 07:36:00 +00:00
#include "common/logging/log.h"
#ifdef _WIN32
#ifndef __func__
#define __func__ __FUNCTION__
#endif
#endif
2014-12-06 23:14:14 +00:00
#if _DEBUG
#define _dbg_assert_(_t_, _a_) \
2014-04-01 23:20:08 +01:00
if (!(_a_)) {\
LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
2014-04-01 23:20:08 +01:00
__LINE__, __FILE__, __TIME__); \
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
}
#define _dbg_assert_msg_(_t_, _a_, ...)\
2014-04-01 23:20:08 +01:00
if (!(_a_)) {\
LOG_CRITICAL(_t_, __VA_ARGS__); \
2014-04-01 23:20:08 +01:00
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
}
#define _dbg_update_() Host_UpdateLogDisplay();
#else // not debug
#define _dbg_update_() ;
#ifndef _dbg_assert_
#define _dbg_assert_(_t_, _a_) {}
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {}
#endif // dbg_assert
2014-12-06 23:14:14 +00:00
#endif
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
#ifdef _WIN32
2014-04-01 23:20:08 +01:00
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
}
#else // not win32
2014-04-01 23:20:08 +01:00
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
}
#endif // WIN32