godot-logger

Crates.io docs.rs GitHub branch checks state

A logger for [godot-rust] projects

godot-logger is an easy-to-use logger for [godot-rust] projects. It prints logs to Godot's output console and supports module-specific log levels.

Usage

Start by adding [godot-logger] and [log] as dependencies to your project's Cargo.toml.

toml [dependencies] godot-logger = "1.0.0" log = "0.4"

Then configure and initialize the logger in the init method that is passed to godot_init!.

```rust use gdnative::prelude::*; use godot_logger::GodotLogger; use log::{Level, LevelFilter};

fn init(handle: InitHandle) { if let Err(error) = GodotLogger::builder() .defaultloglevel(Level::Info) .addfilter("godotlogger", LevelFilter::Debug) .init() { godotwarn!("{}", error.tostring()); }

log::debug!("Initialized the logger");

}

godot_init!(init); ```

The following will be printed in the Output console inside Godot:

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

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.