diff options
author | Mattes D <github@xoft.cz> | 2016-06-17 13:43:58 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-06-18 13:12:11 +0200 |
commit | 96034810dfae37ec0b489ae5d3feb5b756e34e67 (patch) | |
tree | ed621b925f1c1eed44817cd2c2197e6918bf303f | |
parent | SelfTests: Print a quick message on test start. (diff) | |
download | cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.tar cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.tar.gz cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.tar.bz2 cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.tar.lz cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.tar.xz cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.tar.zst cuberite-96034810dfae37ec0b489ae5d3feb5b756e34e67.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Globals.h | 109 |
1 files changed, 55 insertions, 54 deletions
diff --git a/src/Globals.h b/src/Globals.h index dd331cd34..25d2f740e 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -255,72 +255,73 @@ template class SizeChecker<UInt8, 1>; #ifndef TEST_GLOBALS -// These fiunctions are defined in Logger.cpp, but are declared here to avoid including all of logger.h -extern void LOG (const char * a_Format, ...) FORMATSTRING(1, 2); -extern void LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2); -extern void LOGWARNING(const char * a_Format, ...) FORMATSTRING(1, 2); -extern void LOGERROR (const char * a_Format, ...) FORMATSTRING(1, 2); - - - - + // These functions are defined in Logger.cpp, but are declared here to avoid including all of logger.h + extern void LOG (const char * a_Format, ...) FORMATSTRING(1, 2); + extern void LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2); + extern void LOGWARNING(const char * a_Format, ...) FORMATSTRING(1, 2); + extern void LOGERROR (const char * a_Format, ...) FORMATSTRING(1, 2); + + // In debug builds, translate LOGD to LOG, otherwise leave it out altogether: + #ifdef _DEBUG + #define LOGD LOG + #else + #define LOGD(...) + #endif // _DEBUG -// In debug builds, translate LOGD to LOG, otherwise leave it out altogether: -#ifdef _DEBUG - #define LOGD LOG -#else - #define LOGD(...) -#endif // _DEBUG + #define LOGWARN LOGWARNING -#define LOGWARN LOGWARNING #else // Logging functions -void inline LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2); + void inline LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2); -void inline LOGERROR(const char * a_Format, ...) -{ - va_list argList; - va_start(argList, a_Format); - vprintf(a_Format, argList); - putchar('\n'); - va_end(argList); -} + void inline LOGERROR(const char * a_Format, ...) + { + va_list argList; + va_start(argList, a_Format); + vprintf(a_Format, argList); + putchar('\n'); + fflush(stdout); + va_end(argList); + } -void inline LOGWARNING(const char * a_Format, ...) FORMATSTRING(1, 2); + void inline LOGWARNING(const char * a_Format, ...) FORMATSTRING(1, 2); -void inline LOGWARNING(const char * a_Format, ...) -{ - va_list argList; - va_start(argList, a_Format); - vprintf(a_Format, argList); - putchar('\n'); - va_end(argList); -} + void inline LOGWARNING(const char * a_Format, ...) + { + va_list argList; + va_start(argList, a_Format); + vprintf(a_Format, argList); + putchar('\n'); + fflush(stdout); + va_end(argList); + } -void inline LOGD(const char * a_Format, ...) FORMATSTRING(1, 2); + void inline LOGD(const char * a_Format, ...) FORMATSTRING(1, 2); -void inline LOGD(const char * a_Format, ...) -{ - va_list argList; - va_start(argList, a_Format); - vprintf(a_Format, argList); - putchar('\n'); - va_end(argList); -} + void inline LOGD(const char * a_Format, ...) + { + va_list argList; + va_start(argList, a_Format); + vprintf(a_Format, argList); + putchar('\n'); + fflush(stdout); + va_end(argList); + } -void inline LOG(const char * a_Format, ...) FORMATSTRING(1, 2); + void inline LOG(const char * a_Format, ...) FORMATSTRING(1, 2); -void inline LOG(const char * a_Format, ...) -{ - va_list argList; - va_start(argList, a_Format); - vprintf(a_Format, argList); - putchar('\n'); - va_end(argList); -} + void inline LOG(const char * a_Format, ...) + { + va_list argList; + va_start(argList, a_Format); + vprintf(a_Format, argList); + putchar('\n'); + fflush(stdout); + va_end(argList); + } -#define LOGINFO LOG -#define LOGWARN LOGWARNING + #define LOGINFO LOG + #define LOGWARN LOGWARNING #endif |