0

Is there a way to disable the output of Raylib? I'd like to not have this spammed in my terminal:

INFO: Initializing raylib 3.7
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1920 x 1080
INFO:     > Render size:  1024 x 768
INFO:     > Screen size:  1024 x 768
INFO:     > Viewport offsets: 0, 0
INFO: TEXTURE: [ID 1] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID etc...] Unloaded texture data from VRAM (GPU)

There's more of these, this is just a portion of them

Oughie
  • 1
  • 1

1 Answers1

1

Rust Solution 1: You can call

set_trace_log(TraceLogLevel::LOG_ERROR)

to set a higher log level, as mentioned in the docs here.

C Solution 1: Set a higher log level

SetTraceLogLevel(LOG_ERROR); 

possible values are:

LOG_ALL: 0
LOG_TRACE: 1
LOG_DEBUG: 2
LOG_INFO: 3
LOG_WARNING: 4
LOG_ERROR: 5
LOG_FATAL: 6
LOG_NONE: 7

C Solution 2: Use custom callback function

Another way can be seen in this example examples/core/core_custom_logging.c

you should be able to register a callback function for handling log messages

SetTraceLogCallback(CustomLog); #call this before InitWindow() 

InitWindow(screenWidth, screenHeight, "titel");

To receive no log prints whatsoever, the function can be as simple as:

void CustomLog(int msgType, const char *text, va_list args)
{ 
  return;
}
wschopohl
  • 1,567
  • 1
  • 11
  • 18
  • 1
    Hey @Oughie it is really demotivating if you carefully take your time to answer a question and than get not a single reaction in return.. I hope you're not having any troubles and would be happy to hear from you. – wschopohl Jun 29 '23 at 15:37
  • 1
    Hey @wschopohl if it helps, your answer was exactly what I was looking for with my own personal project based on the Raylib-CsLo C# bindings! – Drew Jul 01 '23 at 15:07
  • Hey, I'm glad this answer could help you! Thx! – wschopohl Jul 01 '23 at 18:36
  • Hey @wschopohl, for me what worked (using raylib-bindings for rust) was: ```unsafe { ffi::SetTraceLogLevel(ffi::TraceLogLevel::LOG_ERROR as i32); }``` Sorry for not responding for a long time – Oughie Jul 22 '23 at 16:24
  • Hey @Oughie, if you are using the rust "raylib-rs" you should also be able to use core::logging::set_trace_log, referenced here: https://docs.rs/raylib/latest/raylib/core/logging/fn.set_trace_log.html – wschopohl Jul 26 '23 at 10:47
  • Hey @Oughie, if you feel generous I would be happy if you could accept my answer. It is hard enough to collect points on SO .. :) – wschopohl Aug 15 '23 at 15:42