Skip to content

Commit 9d4ef6f

Browse files
author
toasteater
committed
Some minor editing related to comments folded by GitHub
1 parent bc74c76 commit 9d4ef6f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/recipes/logging.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@ macro_rules! console_print {
2525

2626
A more robust solution is to integrate an existing logging library.
2727

28-
This recipe demonstrates using the log crate with flexi-logger. While most of this guide will work with other backends, the initialization and `LogWriter` implementation may differ.
28+
This recipe demonstrates using the `log` crate with `flexi-logger`. While most of this guide will work with other backends, the initialization and `LogWriter` implementation may differ.
2929

30-
First add the following crates to your `Cargo.toml` file.
30+
First add the following crates to your `Cargo.toml` file. You may want to check the crates.io pages of the crates for any updates.
3131

3232
```toml
3333
log = "0.4.14"
3434
flexi_logger = "0.17.1"
3535
```
3636

37-
As the logger will need to use Godot's logging methods, add a Writer implementation:
38-
39-
When using flexi_logger it requires a LogWriter implementation that can point to the godot_print! macro. Note: this will vary by logging framework.
37+
Then, write some code that glues the logging crates with Godot's logging interface. `flexi-logger`, for example, requires a `LogWriter` implementation:
4038

4139
```rust
4240
use gdnative::prelude::*;
@@ -77,7 +75,7 @@ fn init(handle: InitHandle) {
7775
.log_target(flexi_logger::LogTarget::Writer(Box::new(crate::util::GodotLogWriter {})))
7876
.start()
7977
.expect("the logger should start");
80-
/* Otherclass initialization goes here */
78+
/* other initialization work goes here */
8179
}
8280
godot_init!(init);
8381
```
@@ -159,9 +157,7 @@ impl DebugLogger {
159157
}
160158
```
161159

162-
After adding the above class with the `handle.add_class::<DebugLogger>()` in the `init(handle: InitHandle)` function, add it as an Autoload Singleton in your project and you can access the logging functionality with the following function.
163-
164-
In the example below, I chose the name "game_logger" for the Autoload singleton.
160+
After adding the class above with `handle.add_class::<DebugLogger>()` in the `init` function, you may add it as an Autoload Singleton in your project for easy access. In the example below, the name "game_logger" is chosen for the Autoload singleton:
165161

166162
```gdscript
167163
game_logger.trace("name_of_script.gd", "this is a trace message")

0 commit comments

Comments
 (0)