Skip to content

Commit 514754d

Browse files
committed
Add crate level docs to bevy_log and enable #![warn(missing_docs)] (#3520)
This PR is part of the issue #3492. # Objective - Add crate level docs to the bevy_log documentation to achieve a 100% documentation coverage. - Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future. # Solution - Add and update the bevy_log crate level docs - Add a note about panicking from multiple `LogPlugins` per process. - Add the #![warn(missing_docs)] lint.
1 parent f5039a4 commit 514754d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/bevy_log/src/lib.rs

+20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
#![warn(missing_docs)]
2+
//! This crate provides logging functions and configuration for [Bevy](https://bevyengine.org)
3+
//! apps, and automatically configures platform specific log handlers (i.e. WASM or Android).
4+
//!
5+
//! The macros provided for logging are reexported from [`tracing`](https://docs.rs/tracing),
6+
//! and behave identically to it.
7+
//!
8+
//! By default, the [`LogPlugin`] from this crate is included in Bevy's `DefaultPlugins`
9+
//! and the logging macros can be used out of the box, if used.
10+
//!
11+
//! For more fine-tuned control over logging behavior, insert a [`LogSettings`] resource before
12+
//! adding [`LogPlugin`] or `DefaultPlugins` during app initialization.
13+
114
#[cfg(target_os = "android")]
215
mod android_tracing;
316

417
pub mod prelude {
18+
//! The Bevy Log Prelude.
519
#[doc(hidden)]
620
pub use bevy_utils::tracing::{
721
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
@@ -61,6 +75,12 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
6175
/// .run();
6276
/// }
6377
/// ```
78+
///
79+
/// # Panics
80+
///
81+
/// This plugin should not be added multiple times in the same process. This plugin
82+
/// sets up global logging configuration for **all** Apps in a given process, and
83+
/// rerunning the same initialization multiple times will lead to a panic.
6484
#[derive(Default)]
6585
pub struct LogPlugin;
6686

0 commit comments

Comments
 (0)