|
|
@ -92,53 +92,51 @@ void SetTraceLogCallback(TraceLogCallback callback) |
|
|
|
} |
|
|
|
|
|
|
|
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG) |
|
|
|
void TraceLog(kt">int msgType, const char *text, ...) |
|
|
|
void TraceLog(n">TraceLogType logType, const char *text, ...) |
|
|
|
{ |
|
|
|
#if defined(SUPPORT_TRACELOG) |
|
|
|
char buffer[MAX_TRACELOG_BUFFER_SIZE] = { 0 }; |
|
|
|
if (logType < logTypeLevel) { // Message has level below current threshold, don't emit. |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
va_list args; |
|
|
|
va_start(args, text); |
|
|
|
|
|
|
|
if (logCallback) |
|
|
|
{ |
|
|
|
logCallback(msgType, text, args); |
|
|
|
logCallback(logType, text, args); |
|
|
|
va_end(args); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
switch(msgType) |
|
|
|
{ |
|
|
|
case LOG_INFO: strcpy(buffer, "INFO: "); break; |
|
|
|
case LOG_ERROR: strcpy(buffer, "ERROR: "); break; |
|
|
|
case LOG_WARNING: strcpy(buffer, "WARNING: "); break; |
|
|
|
case LOG_DEBUG: strcpy(buffer, "DEBUG: "); break; |
|
|
|
case LOG_OTHER: strcpy(buffer, "OTHER: "); break; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
|
|
|
|
strcat(buffer, text); |
|
|
|
strcat(buffer, "\n"); |
|
|
|
|
|
|
|
#if defined(PLATFORM_ANDROID) |
|
|
|
switch(msgType) |
|
|
|
switch(logType) |
|
|
|
{ |
|
|
|
case LOG_INFO: if (logTypeFlags & LOG_INFO) __android_log_vprint(ANDROID_LOG_INFO, "raylib", buffer, args); break; |
|
|
|
case LOG_WARNING: if (logTypeFlags & LOG_WARNING) __android_log_vprint(ANDROID_LOG_WARN, "raylib", buffer, args); break; |
|
|
|
case LOG_ERROR: if (logTypeFlags & LOG_ERROR) __android_log_vprint(ANDROID_LOG_ERROR, "raylib", buffer, args); break; |
|
|
|
case LOG_DEBUG: if (logTypeFlags & LOG_DEBUG) __android_log_vprint(ANDROID_LOG_DEBUG, "raylib", buffer, args); break; |
|
|
|
case LOG_OTHER: if (logTypeFlags & LOG_OTHER) __android_log_vprint(ANDROID_LOG_VERBOSE, "raylib", buffer, args); break; |
|
|
|
case LOG_TRACE: __android_log_vprint(ANDROID_LOG_VERBOSE, "raylib", text, args); break; |
|
|
|
case LOG_DEBUG: __android_log_vprint(ANDROID_LOG_DEBUG, "raylib", text, args); break; |
|
|
|
case LOG_INFO: __android_log_vprint(ANDROID_LOG_INFO, "raylib", text, args); ; break; |
|
|
|
case LOG_WARNING: __android_log_vprint(ANDROID_LOG_WARN, "raylib", text, args); break; |
|
|
|
case LOG_ERROR: __android_log_vprint(ANDROID_LOG_ERROR, "raylib", text, args); break; |
|
|
|
case LOG_FATAL: __android_log_vprint(ANDROID_LOG_FATAL, "raylib", text, args); break; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
#else |
|
|
|
switch(msgType) |
|
|
|
char buffer[MAX_TRACELOG_BUFFER_SIZE] = { 0 }; |
|
|
|
|
|
|
|
switch(logType) |
|
|
|
{ |
|
|
|
case LOG_INFO: if (logTypeFlags & LOG_INFO) vprintf(buffer, args); break; |
|
|
|
case LOG_WARNING: if (logTypeFlags & LOG_WARNING) vprintf(buffer, args); break; |
|
|
|
case LOG_ERROR: if (logTypeFlags & LOG_ERROR) vprintf(buffer, args); break; |
|
|
|
case LOG_DEBUG: if (logTypeFlags & LOG_DEBUG) vprintf(buffer, args); break; |
|
|
|
case LOG_OTHER: if (logTypeFlags & LOG_OTHER) vprintf(buffer, args); break; |
|
|
|
case LOG_TRACE: strcpy(buffer, "TRACE: "); break; |
|
|
|
case LOG_DEBUG: strcpy(buffer, "DEBUG: "); break; |
|
|
|
case LOG_INFO: strcpy(buffer, "INFO: "); ; break; |
|
|
|
case LOG_WARNING: strcpy(buffer, "WARN: "); break; |
|
|
|
case LOG_ERROR: strcpy(buffer, "ERROR: "); break; |
|
|
|
case LOG_FATAL: strcpy(buffer, "FATAL: "); break; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
|
|
|
|
strcat(buffer, text); |
|
|
|
strcat(buffer, "\n"); |
|
|
|
vprintf(buffer, args); |
|
|
|
#endif |
|
|
|
|
|
|
|
va_end(args); |
|
|
|