|
|
@ -16,9 +16,6 @@ |
|
|
|
* Show TraceLog() output messages |
|
|
|
* NOTE: By default LOG_DEBUG traces not shown |
|
|
|
* |
|
|
|
* #define SUPPORT_TRACELOG_DEBUG |
|
|
|
* Show TraceLog() LOG_DEBUG messages |
|
|
|
* |
|
|
|
* DEPENDENCIES: |
|
|
|
* stb_image_write - BMP/PNG writting functions |
|
|
|
* |
|
|
@ -45,7 +42,6 @@ |
|
|
|
**********************************************************************************************/ |
|
|
|
|
|
|
|
#define SUPPORT_TRACELOG // Output tracelog messages |
|
|
|
//#define SUPPORT_TRACELOG_DEBUG // Avoid LOG_DEBUG messages tracing |
|
|
|
|
|
|
|
#include "raylib.h" // WARNING: Required for: LogType enum |
|
|
|
#include "utils.h" |
|
|
@ -63,12 +59,16 @@ |
|
|
|
|
|
|
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) |
|
|
|
#define STB_IMAGE_WRITE_IMPLEMENTATION |
|
|
|
#include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png() |
|
|
|
#include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png() |
|
|
|
#endif |
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------- |
|
|
|
// Global Variables Definition |
|
|
|
//---------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
// Log types messages supported flags (bit based) |
|
|
|
static unsigned char logTypeFlags = LOG_INFO | LOG_WARNING | LOG_ERROR; |
|
|
|
|
|
|
|
#if defined(PLATFORM_ANDROID) |
|
|
|
AAssetManager *assetManager; |
|
|
|
#endif |
|
|
@ -87,16 +87,17 @@ static int android_close(void *cookie); |
|
|
|
// Module Functions Definition - Utilities |
|
|
|
//---------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
// Enable trace log message types (bit flags based) |
|
|
|
void SetTraceLogTypes(unsigned char types) |
|
|
|
{ |
|
|
|
logTypeFlags = types; |
|
|
|
} |
|
|
|
|
|
|
|
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG) |
|
|
|
void TraceLog(int msgType, const char *text, ...) |
|
|
|
{ |
|
|
|
#if defined(SUPPORT_TRACELOG) |
|
|
|
static char buffer[128]; |
|
|
|
int traceDebugMsgs = 0; |
|
|
|
|
|
|
|
#if defined(SUPPORT_TRACELOG_DEBUG) |
|
|
|
traceDebugMsgs = 1; |
|
|
|
#endif |
|
|
|
|
|
|
|
switch(msgType) |
|
|
|
{ |
|
|
@ -116,14 +117,21 @@ void TraceLog(int msgType, const char *text, ...) |
|
|
|
#if defined(PLATFORM_ANDROID) |
|
|
|
switch(msgType) |
|
|
|
{ |
|
|
|
case LOG_INFO: __android_log_vprint(ANDROID_LOG_INFO, "raylib", buffer, args); break; |
|
|
|
case LOG_ERROR: __android_log_vprint(ANDROID_LOG_ERROR, "raylib", buffer, args); break; |
|
|
|
case LOG_WARNING: __android_log_vprint(ANDROID_LOG_WARN, "raylib", buffer, args); break; |
|
|
|
case LOG_DEBUG: if (traceDebugMsgs) __android_log_vprint(ANDROID_LOG_DEBUG, "raylib", buffer, args); break; |
|
|
|
case LOG_INFO: k">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; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
#else |
|
|
|
if ((msgType != LOG_DEBUG) || ((msgType == LOG_DEBUG) && (traceDebugMsgs))) vprintf(buffer, args); |
|
|
|
switch(msgType) |
|
|
|
{ |
|
|
|
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; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
va_end(args); |
|
|
|