Crate godot_logger[][src]

Expand description

A simple logger that prints to Godot’s output window

godot-logger is a simple logger that prints log messages to the output console inside the Godot game engine. It is built around the logging facade of the log crate, and uses the godot_print! macro from the gdnative bindings.

Use

Add godot-logger and log as dependencies to Cargo.toml.

Then initialize godot-logger in the init function that is exported by gdnative.

use gdnative::prelude::*;
use log::Level;

fn init(handle: InitHandle) {
    godot_logger::init(Level::Debug);
    log::debug!("Initialized the logger");
}

godot_init!(init);

The following will appear in the Output console inside Godot:

2021-09-25 19:29:25 DEBUG Initialized the logger

Functions

Initialize the logger