From 9ab99bccd6a01f34649e83b47fc817acdbfbb519 Mon Sep 17 00:00:00 2001 From: Peter0x44 Date: Tue, 23 Jan 2024 00:35:47 +0000 Subject: [PATCH] Send raylib logs to stderr by default from man stderr: Under normal circumstances every UNIX program has three streams opened for it when it starts up, one for input, one for output, and one for printing diagnostic or error messages. It's a more appropriate place for programs to send logs, as it's a stream meant explicitly for it. stderr is unbuffered, so it doesn't need to be flushed. --- src/utils.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils.c b/src/utils.c index 987021c73..4b0bcb161 100644 --- a/src/utils.c +++ b/src/utils.c @@ -45,7 +45,7 @@ #endif #include // Required for: exit() -#include // Required for: FILE, fopen(), fseek(), ftell(), fread(), fwrite(), fprintf(), vprintf(), fclose() +#include // Required for: FILE, fopen(), fseek(), ftell(), fread(), fwrite(), fprintf(), vfprintf(), fclose() #include // Required for: va_list, va_start(), va_end() #include // Required for: strcpy(), strcat() @@ -147,8 +147,7 @@ void TraceLog(int logType, const char *text, ...) unsigned int textSize = (unsigned int)strlen(text); memcpy(buffer + strlen(buffer), text, (textSize < (MAX_TRACELOG_MSG_LENGTH - 12))? textSize : (MAX_TRACELOG_MSG_LENGTH - 12)); strcat(buffer, "\n"); - vprintf(buffer, args); - fflush(stdout); + vfprintf(stderr, buffer, args); #endif va_end(args);