@@ -5056,18 +5056,23 @@ pub fn log_output(
50565056 args : anytype ,
50575057) void {
50585058 const prefix = "[" ++ comptime level ++ "] " ;
5059- if (scope != .term_scope ) {
5060- var buf : [3000 ]u8 = undefined ;
5061- if (std .fmt .bufPrintZ (& buf , prefix ++ format , args )) | f | {
5062- sdl .SDL_LogInfo (@intFromEnum (SdlLogCategory .application ), f .ptr );
5063- } else | _ | {
5064- sdl .SDL_LogInfo (@intFromEnum (SdlLogCategory .application ), prefix ++ format );
5065- }
5066- }
5067- std .debug .lockStdErr ();
5068- defer std .debug .unlockStdErr ();
5069- const stderr = std .io .getStdErr ().writer ();
5070- nosuspend stderr .print (prefix ++ format ++ "\n " , args ) catch return ;
5059+ if (builtin .mode == .Debug ) {
5060+ // Log to terminal in debug mode
5061+ std .debug .lockStdErr ();
5062+ defer std .debug .unlockStdErr ();
5063+ const stderr = std .io .getStdErr ().writer ();
5064+ nosuspend stderr .print (prefix ++ format ++ "\n " , args ) catch return ;
5065+ } else {
5066+ // Log using SDL when in release mode
5067+ if (scope != .term_scope ) {
5068+ var buf : [3000 ]u8 = undefined ;
5069+ if (std .fmt .bufPrintZ (& buf , prefix ++ format , args )) | f | {
5070+ sdl .SDL_LogInfo (@intFromEnum (SdlLogCategory .application ), f .ptr );
5071+ } else | _ | {
5072+ sdl .SDL_LogInfo (@intFromEnum (SdlLogCategory .application ), prefix ++ format );
5073+ }
5074+ }
5075+ }
50715076}
50725077
50735078pub fn log_output_handler (
0 commit comments