From 2139d7d45fb1a8ed250ad96c9975c581f02f72a9 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Tue, 13 Oct 2015 03:57:44 -0400 Subject: Refactor logging - Add warning log level - Change debug_log_level setting to enumeration string - Map Irrlicht log events to MT log events - Encapsulate log_* functions and global variables into a class, Logger - Unify dstream with standard logging mechanism - Unify core.debug() with standard core.log() script API --- src/debug.h | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/debug.h') diff --git a/src/debug.h b/src/debug.h index 2ccbe58ba..b7521fec2 100644 --- a/src/debug.h +++ b/src/debug.h @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include "gettime.h" +#include "log.h" #if (defined(WIN32) || defined(_WIN32_WCE)) #define WIN32_LEAN_AND_MEAN @@ -36,9 +37,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #define __NORETURN __declspec(noreturn) #define __FUNCTION_NAME __FUNCTION__ + #define NORETURN __declspec(noreturn) + #define FUNCTION_NAME __FUNCTION__ #else #define __NORETURN __attribute__ ((__noreturn__)) #define __FUNCTION_NAME __PRETTY_FUNCTION__ + #define NORETURN __attribute__ ((__noreturn__)) + #define FUNCTION_NAME __PRETTY_FUNCTION__ #endif // Whether to catch all std::exceptions. @@ -50,30 +55,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define CATCH_UNHANDLED_EXCEPTIONS 0 #endif -/* - Debug output -*/ - -#define DTIME (getTimestamp()+": ") - -extern void debugstreams_init(bool disable_stderr, const char *filename); -extern void debugstreams_deinit(); - -// This is used to redirect output to /dev/null -class Nullstream : public std::ostream { -public: - Nullstream(): - std::ostream(0) - { - } -private: -}; - -extern std::ostream dstream; -extern std::ostream dstream_no_stderr; -extern Nullstream dummyout; - - /* Abort program execution immediately */ __NORETURN extern void fatal_error_fn( @@ -108,6 +89,8 @@ __NORETURN extern void sanity_check_fn( void debug_set_exception_handler(); +#define DTIME "" + /* DebugStack */ -- cgit v1.2.3