chore: switch to tracing

This commit is contained in:
Michael Aaron Murphy 2023-05-30 21:51:23 +02:00
parent a66df3b981
commit 18527db707
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
3 changed files with 78 additions and 43 deletions

View file

@ -25,9 +25,9 @@ rust-embed = "6.6.1"
slotmap = "1.0.6"
tokio = "1.28.2"
downcast-rs = "1.2.0"
log = "0.4"
env_logger = "0.10"
cosmic-panel-config = { git = "https://github.com/pop-os/cosmic-panel" }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"]}
[dependencies.i18n-embed]
version = "0.13.9"

View file

@ -18,8 +18,6 @@ pub mod widget;
pub mod pages;
use env_logger::Env;
use cosmic::{
iced::{wayland::actions::window::SctkWindowSettings, Application, Limits},
iced_sctk::settings::InitialSurface,
@ -30,17 +28,27 @@ use i18n_embed::DesktopLanguageRequester;
///
/// Returns error if iced fails to run the application.
pub fn main() -> color_eyre::Result<()> {
let env = Env::default()
.filter_or("MY_LOG_LEVEL", "info")
.write_style_or("MY_LOG_STYLE", "always");
env_logger::init_from_env(env);
color_eyre::install()?;
if std::env::var("RUST_SPANTRACE").is_err() {
std::env::set_var("RUST_SPANTRACE", "0");
}
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "info");
}
tracing_subscriber::fmt()
.pretty()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_writer(std::io::stderr)
.without_time()
.with_line_number(true)
.with_file(true)
.with_target(false)
.with_thread_names(true)
.init();
let localizer = crate::localize::localizer();
let requested_languages = DesktopLanguageRequester::requested_languages();