Skip to content

#17: Add logging

Carlos Marques requested to merge carl_marqs/welcome_to_uni:GL-17 into develop

Closes #17.

Following this guide for GNative, the Logger singleton was created using the node GlobalLogger.

image

The GlobalLogger node contains only one exported property: level_filter. By default, it's set as Debug for debug builds and Info for release builds. It's OK to change the value locally for debugging purposes, but it should remain with the default values when exporting the project.

image

In order to process logs as soon as possible, this singleton should be the first in the list. When the node initialized, logs are automatically pushed to the Godot console asynchronously according to the selected level_filter.

image

Running the manager/game/debug.tscn scene with level_filter = "Trace":

image

Godot automatically saves logs to files:

image

image

It might raise some errors when running from the editor, but that's not really a problem and doesn't happen when the game is exported. It's caused when the GlobalLogger constructor is called multiple times, causing flexi_logger to fail.


  • Added some tags to the project: 3d, gdextension and rust;
  • Added the project setting config/url;
  • Workspace members now inherit some values from root's Cargo.toml: edition, publish, and version;
  • Dockerfile and docker stage removed. There's a proper branch now;
  • Added .rustfmt.
Edited by Carlos Marques

Merge request reports