Add log crate compatibility to bevy_log

This commit is contained in:
Carter Anderson 2021-06-28 12:23:45 -07:00
parent b1a91a823f
commit 829f723bf3
2 changed files with 3 additions and 1 deletions

View file

@ -19,6 +19,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.5.0" }
tracing-subscriber = {version = "0.2.15", features = ["registry"]}
tracing-chrome = { version = "0.3.0", optional = true }
tracing-log = "0.1.2"
[target.'cfg(target_os = "android")'.dependencies]
android_log-sys = "0.2.0"

View file

@ -13,6 +13,7 @@ pub use bevy_utils::tracing::{
};
use bevy_app::{App, Plugin};
use tracing_log::LogTracer;
#[cfg(feature = "tracing-chrome")]
use tracing_subscriber::fmt::{format::DefaultFields, FormattedFields};
use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
@ -86,7 +87,7 @@ impl Plugin for LogPlugin {
let settings = app.world.get_resource_or_insert_with(LogSettings::default);
format!("{},{}", settings.level, settings.filter)
};
LogTracer::init().unwrap();
let filter_layer = EnvFilter::try_from_default_env()
.or_else(|_| EnvFilter::try_new(&default_filter))
.unwrap();