This commit is contained in:
Attila Uygun 2023-08-09 23:00:38 +02:00
parent 2ac1520c9b
commit eb50e547b8
1 changed files with 7 additions and 0 deletions

View File

@ -2,10 +2,13 @@
#if defined(__ANDROID__) #if defined(__ANDROID__)
#include <android/log.h> #include <android/log.h>
#elif defined(_WIN32)
#include <windows.h>
#else #else
#include <cstdio> #include <cstdio>
#endif #endif
#include <cstdlib> #include <cstdlib>
#include <format>
#include <string> #include <string>
namespace base { namespace base {
@ -38,6 +41,10 @@ LogMessage::~LogMessage() {
#if defined(__ANDROID__) #if defined(__ANDROID__)
__android_log_print(ANDROID_LOG_ERROR, "kaliber", "%d [%s:%d] %s", __android_log_print(ANDROID_LOG_ERROR, "kaliber", "%d [%s:%d] %s",
verbosity_level_, filename.c_str(), line_, text.c_str()); verbosity_level_, filename.c_str(), line_, text.c_str());
#elif defined(_WIN32)
std::string s = std::format("{} [{}:{}] {}", verbosity_level_,
filename.c_str(), line_, text.c_str());
OutputDebugStringA(s.c_str());
#else #else
printf("%d [%s:%d] %s", verbosity_level_, filename.c_str(), line_, printf("%d [%s:%d] %s", verbosity_level_, filename.c_str(), line_,
text.c_str()); text.c_str());