mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
Logging cleanup (#69)
* Mac OS X 10.6 & More C++03 Support * Fix SDL2 options.txt loading for C++03 * Output/Logging Overhaul * Added StandardOut class * Renamed LOGX macros to LOG_X * Removed LogMsg macros in favor of LOG_X * Added console window for debug Windows builds * Updated Xcode Project + StandardOut.hpp + StandardOut.cpp * StandardOut_windows * Replaced the Windows #ifdefs in StandardOut with StandardOut_windows --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com>
This commit is contained in:
42
source/common/StandardOut.hpp
Normal file
42
source/common/StandardOut.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class StandardOut
|
||||
{
|
||||
private:
|
||||
static StandardOut* m_singleton;
|
||||
public:
|
||||
static StandardOut* const singleton();
|
||||
|
||||
StandardOut();
|
||||
~StandardOut();
|
||||
|
||||
virtual void print(const char* const str);
|
||||
virtual void print(std::string str);
|
||||
virtual void vprintf(const char* const fmt, va_list argPtr);
|
||||
virtual void printf(const char* const fmt, ...);
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#define LOG(...) StandardOut::singleton()->printf(__VA_ARGS__)
|
||||
|
||||
#ifdef PLATFORM_ANDROID
|
||||
#define LOG_I(...) __android_log_print(ANDROID_LOG_INFO, "MinecraftPE", __VA_ARGS__)
|
||||
#define LOG_W(...) __android_log_print(ANDROID_LOG_WARN, "MinecraftPE", __VA_ARGS__)
|
||||
#define LOG_E(...) __android_log_print(ANDROID_LOG_ERROR, "MinecraftPE", __VA_ARGS__)
|
||||
#else
|
||||
#define LOG_I(...) LOG("[Info]: " __VA_ARGS__)
|
||||
#define LOG_W(...) LOG("[WARN]: " __VA_ARGS__)
|
||||
#define LOG_E(...) LOG("[ERROR]: " __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define LOG(...)
|
||||
#define LOG_I(...)
|
||||
#define LOG_W(...)
|
||||
#define LOG_E(...)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user