Latest commit b724a0f
use bevy::prelude::*; /// 这个例子说明了如何在 bevy 中使用日志 fn main() { App::new() // 取消注释即可用新的日志设置来覆盖默认的日志设置: // .insert_resource(bevy::log::LogSettings { // level: bevy::log::Level::TRACE, // filter: "wgpu=warn,bevy_ecs=info".to_string(), // }) .add_plugins(DefaultPlugins) .add_system(日志) .run(); } fn 日志() { // 下面是在每个“日志级别”(按从“最不重要”到“最重要”的顺序)编写新日志的方式: trace!("very noisy"); debug!("helpful for debugging"); info!("helpful information that is worth printing by default"); warn!("something bad happened that is worth printing by default"); error!("something failed"); // 默认情况下,跟踪和调试日志会被忽略,因为它们“嘈杂”, // 可以通过添加LogSettings资源来控制记录的级别,也可以通过RUST_LOG = LEVEL环境变量来设置日志级别, // 例如:RUST_LOG = trace,RUST_LOG = info ,bevy_ecs =warn >此处使用的格式非常灵活。 // 查看:https://docs.rs/tracing-subscriber/*/tracing_subscriber/filter/struct.EnvFilter.html }