This commit is contained in:
Attila Uygun 2023-08-12 22:57:54 +02:00
parent 0a78316bce
commit 1b6352b775
2 changed files with 12 additions and 7 deletions

View File

@ -134,9 +134,11 @@ add_library(kaliber SHARED
../../../src/third_party/glslang/SPIRV/SPVRemapper.cpp
../../../src/third_party/glslang/SPIRV/SpvTools.cpp
../../../src/third_party/jsoncpp/jsoncpp.cpp
../../../src/third_party/minimp3/minimp3.cc
../../../src/third_party/minizip/ioapi.c
../../../src/third_party/minizip/unzip.c
../../../src/third_party/spirv-reflect/spirv_reflect.c
../../../src/third_party/stb/stb_image.cc
../../../src/third_party/texture_compressor/dxt_encoder_internals.cc
../../../src/third_party/texture_compressor/dxt_encoder.cc
../../../src/third_party/texture_compressor/texture_compressor_etc1.cc

View File

@ -4,11 +4,11 @@
#include <android/log.h>
#elif defined(_WIN32)
#include <windows.h>
#include <format>
#else
#include <iostream>
#include <cstdio>
#endif
#include <cstdlib>
#include <format>
#include <string>
namespace base {
@ -38,14 +38,17 @@ LogMessage::~LogMessage() {
size_t last_slash_pos = filename.find_last_of("\\/");
if (last_slash_pos != std::string::npos)
filename = filename.substr(last_slash_pos + 1);
std::string log_str = std::format("{} [{}:{}] {}", verbosity_level_,
filename.c_str(), line_, message.c_str());
#if defined(__ANDROID__)
__android_log_print(ANDROID_LOG_ERROR, "kaliber", "%s", log_str.c_str());
__android_log_print(ANDROID_LOG_ERROR, "kaliber", "%d [%s:%d] %s",
verbosity_level_, filename.c_str(), line_,
message.c_str());
#elif defined(_WIN32)
OutputDebugStringA(log_str.c_str());
OutputDebugStringA(
std::format("{} [{}:{}] {}", verbosity_level_, filename, line_, message)
.c_str());
#else
std::clog << log_str;
printf("%d [%s:%d] %s", verbosity_level_, filename.c_str(), line_,
message.c_str());
#endif
}