gBar/src/Log.h
scorpion-26 16933c24ff Add log file
Plus refactoring out the logging.
2023-02-21 22:20:02 +01:00

28 lines
715 B
C++

#pragma once
#include <sstream>
#ifdef USE_LOGFILE
#define LOG(x) \
std::cout << x << '\n'; \
{ \
std::stringstream str; \
str << x; \
Logging::Log(str.str()); \
}
#else
#define LOG(x) std::cout << x << '\n'
#endif
#define ASSERT(x, log) \
if (!(x)) \
{ \
LOG(log << "\n[Exiting due to assert failed]"); \
exit(-1); \
}
namespace Logging
{
void Init();
void Log(const std::string& str);
void Shutdown();
}