diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-10-13 03:57:44 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-10-14 01:03:54 -0400 |
commit | 2139d7d45fb1a8ed250ad96c9975c581f02f72a9 (patch) | |
tree | 3e954063710add83723798937637db7c67a254eb /src/debug.h | |
parent | e0b57c1140554fccbf3e57a036cc4100887ab8f1 (diff) | |
download | minetest-2139d7d45fb1a8ed250ad96c9975c581f02f72a9.tar.gz minetest-2139d7d45fb1a8ed250ad96c9975c581f02f72a9.tar.bz2 minetest-2139d7d45fb1a8ed250ad96c9975c581f02f72a9.zip |
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
Diffstat (limited to 'src/debug.h')
-rw-r--r-- | src/debug.h | 31 |
1 files changed, 7 insertions, 24 deletions
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 <exception> #include <assert.h> #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 */ |