From eab8212830b1a875512dc97bbc7f579b9c5d6170 Mon Sep 17 00:00:00 2001 From: shekohex Date: Thu, 28 Nov 2024 12:51:50 +0200 Subject: [PATCH 1/5] Replace dbg! call with trace! in src/asset.rs Fixes #53 * Replace the `dbg!` call with `trace!(?properties, "user properties")` to log the properties at the trace level. --- src/asset.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/asset.rs b/src/asset.rs index 8e9f942..4df1c0b 100644 --- a/src/asset.rs +++ b/src/asset.rs @@ -1,5 +1,3 @@ -//! This module contains all [Asset]s definition. - use std::io::{Cursor, Error as IoError, ErrorKind, Read}; #[cfg(feature = "user_properties")] use std::ops::Deref; @@ -164,7 +162,7 @@ impl AssetLoader for TiledLoader { DeserializedMapProperties::load(&map, self.registry.read().deref(), load_context); #[cfg(feature = "user_properties")] - dbg!(&properties); + trace!(?properties, "user properties"); let asset_map = TiledMap { map, From 58b3525a898e1db5c878f5e35f0dafb59572c02e Mon Sep 17 00:00:00 2001 From: shekohex Date: Thu, 28 Nov 2024 12:53:01 +0200 Subject: [PATCH 2/5] chore: Add module documentation comment in asset.rs --- src/asset.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/asset.rs b/src/asset.rs index 4df1c0b..686abd8 100644 --- a/src/asset.rs +++ b/src/asset.rs @@ -1,3 +1,5 @@ +//! This module contains all [Asset]s definition. + use std::io::{Cursor, Error as IoError, ErrorKind, Read}; #[cfg(feature = "user_properties")] use std::ops::Deref; From cbe80d0981de8b6afc81613c5fbdedda46d28e6c Mon Sep 17 00:00:00 2001 From: shekohex Date: Fri, 29 Nov 2024 21:54:51 +0200 Subject: [PATCH 3/5] chore: Add logging section to debug guide --- book/src/guides/debug.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/book/src/guides/debug.md b/book/src/guides/debug.md index b7ebe9a..42705e2 100644 --- a/book/src/guides/debug.md +++ b/book/src/guides/debug.md @@ -86,3 +86,21 @@ fn main() { ``` And you also need to enable either the `debug-render-2d` feature on `bevy_rapier2d` crate or the `rapier_debug` feature on `bevy_ecs_tiled` + +## Logging + +Bevy uses the `tracing` crate for logging, which is very powerful in debugging and profiling, you can find more information in the [official documentation](https://docs.rs/tracing/). + +We recommend to enable the `trace` level in your application to get more informations about what's happening, just set the `RUST_LOG` environment variable to `trace`: + +```sh +RUST_LOG=trace cargo run +``` + +But this will be very verbose, so you can also filter the logs to only display the informations you need: + +```sh +RUST_LOG=bevy_ecs_tiled=trace cargo run +``` + +This will only display logs from the `bevy_ecs_tiled` crate in `trace` level. From 8a8b25f5d3d7ac244c623ca52d4e894776cf749a Mon Sep 17 00:00:00 2001 From: shekohex Date: Fri, 29 Nov 2024 21:57:44 +0200 Subject: [PATCH 4/5] chore: Update CHANGELOG for v0.4.2 changes --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edd7fc2..9fd3a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## [unreleased] +## v0.4.2 + +### Changed + +- Removed the `dbg!` macro from the codebase and replaced it with `trace!` (#54) + +### Documentation + +- Added a note about the `logging` and `tracing` features in the debugging guide (#54) + ## v0.4.1 ### Changed From 1b2b2d5a21f163bd80b6186f1112182a18153986 Mon Sep 17 00:00:00 2001 From: shekohex Date: Fri, 29 Nov 2024 22:02:28 +0200 Subject: [PATCH 5/5] lint: Simplify lifetime parameters in ResourceReader implementation --- src/asset.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asset.rs b/src/asset.rs index 686abd8..1927987 100644 --- a/src/asset.rs +++ b/src/asset.rs @@ -50,7 +50,7 @@ impl<'a, 'b> BytesResourceReader<'a, 'b> { } } -impl<'a, 'b> tiled::ResourceReader for BytesResourceReader<'a, 'b> { +impl<'a> tiled::ResourceReader for BytesResourceReader<'a, '_> { type Resource = Box; type Error = IoError;