mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +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:
50
source/common/StandardOut.cpp
Normal file
50
source/common/StandardOut.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <iostream>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "StandardOut.hpp"
|
||||
#include "Util.hpp"
|
||||
|
||||
StandardOut* StandardOut::m_singleton = nullptr;
|
||||
|
||||
StandardOut* const StandardOut::singleton()
|
||||
{
|
||||
return m_singleton;
|
||||
}
|
||||
|
||||
StandardOut::StandardOut()
|
||||
{
|
||||
// Stick with the first output handle we get
|
||||
if (!m_singleton)
|
||||
m_singleton = this;
|
||||
}
|
||||
|
||||
StandardOut::~StandardOut()
|
||||
{
|
||||
if (m_singleton == this)
|
||||
m_singleton = nullptr;
|
||||
}
|
||||
|
||||
void StandardOut::print(const char* const str)
|
||||
{
|
||||
std::cout << str << std::endl;
|
||||
}
|
||||
|
||||
void StandardOut::print(std::string str)
|
||||
{
|
||||
print(str.c_str());
|
||||
}
|
||||
|
||||
void StandardOut::vprintf(const char* const fmt, va_list argPtr)
|
||||
{
|
||||
print(Util::vformat(fmt, argPtr));
|
||||
}
|
||||
|
||||
void StandardOut::printf(const char* const fmt, ...)
|
||||
{
|
||||
va_list argList;
|
||||
va_start(argList, fmt);
|
||||
|
||||
vprintf(fmt, argList);
|
||||
|
||||
va_end(argList);
|
||||
}
|
||||
Reference in New Issue
Block a user