32 #if defined(OVR_OS_WIN32)
34 #elif defined(OVR_OS_ANDROID)
35 #include <android/log.h>
60 #ifndef OVR_BUILD_DEBUG
73 va_start(argList, pfmt);
74 LogMessageVarg(messageType, pfmt, argList);
80 const char* fmt, va_list argList)
82 bool addNewline =
true;
89 case Log_Text: buffer[0] = 0; addNewline =
false;
break;
98 char *buffer2 = buffer + prefixLength;
99 OVR_vsprintf(buffer2, bufferSize - prefixLength, fmt, argList);
109 #if defined(OVR_OS_WIN32)
111 static DWORD dummyMode;
113 (GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &dummyMode));
115 if (!hasConsole || debug)
117 ::OutputDebugStringA(formattedText);
121 fputs(formattedText, stdout);
124 #elif defined(OVR_OS_ANDROID)
125 __android_log_write(ANDROID_LOG_INFO,
"OVR", formattedText);
128 fputs(formattedText, stdout);
156 static Log defaultLog;
164 #define OVR_LOG_FUNCTION_IMPL(Name) \
165 void Log##Name(const char* fmt, ...) \
169 va_list argList; va_start(argList, fmt); \
170 OVR_GlobalLog->LogMessageVarg(Log_##Name, fmt, argList); \
178 #ifdef OVR_BUILD_DEBUG
UPInt OVR_CDECL OVR_vsprintf(char *dest, UPInt destsize, const char *format, va_list argList)
static bool IsDebugMessage(LogMessageType messageType)
#define OVR_LOG_FUNCTION_IMPL(Name)
static void DefaultLogOutput(const char *textBuffer, bool debug)
static void SetGlobalLog(Log *log)
virtual void LogMessageVarg(LogMessageType messageType, const char *fmt, va_list argList)
char *OVR_CDECL OVR_strcpy(char *dest, UPInt destsize, const char *src)
void LogMessage(LogMessageType messageType, const char *fmt,...) OVR_LOG_VAARG_ATTRIBUTE(3
static Log * GetDefaultLog()
char *OVR_CDECL OVR_strcat(char *dest, UPInt destsize, const char *src)
void static void FormatLog(char *buffer, unsigned bufferSize, LogMessageType messageType, const char *fmt, va_list argList)
static Log * GetGlobalLog()
Log *volatile OVR_GlobalLog
UPInt OVR_CDECL OVR_strlen(const char *str)
#define OVR_UNUSED2(a1, a2)