21 #include "hx3d/utils/log.hpp" 27 #include <android/log.h> 28 #define LOG(msg) __android_log_print(ANDROID_LOG_VERBOSE, "hx3d", msg, 1) 30 #include "TargetConditionals.h" 31 #ifdef TARGET_OS_IPHONE 32 #include <CoreFoundation/CoreFoundation.h> 34 void NSLog(CFStringRef format, ...);
35 void NSLogv(CFStringRef format, va_list args);
38 #define LOG(msg) NSLog(CFStringCreateWithCString(kCFAllocatorDefault, msg, kCFStringEncodingUTF8)) 40 #define LOG(msg) std::cout << msg << std::endl 43 #define LOG(msg) std::cout << msg << std::endl 48 LogImpl::LogImpl(): _consoleOutput(true) {
55 _consoleOutput = value;
61 write(
format(fmt, args), Status::Info);
68 write(
format(fmt, args), Status::Shader);
75 write(
format(fmt, args), Status::Error);
81 void LogImpl::write(std::string text, Status status) {
83 std::ostringstream oss;
84 if (status == Status::Error) {
88 else if (status == Status::Shader) {
92 else if (status == Status::Info) {
99 LOG(oss.str().c_str());
std::string format(const std::string fmt,...)
Format a string using printf notation.
void DisplayOnConsole(bool value)
Display the log on the console.
void Error(const std::string fmt,...)
Write an error message.
void Shader(const std::string fmt,...)
Write a shader message.
void Info(const std::string fmt,...)
Write an info message.