generated from hack-ink/rust-initializer
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70f6ec6
commit b336d10
Showing
7 changed files
with
123 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,8 @@ mod prelude { | |
use app_dirs2::{AppDataType, AppInfo}; | ||
use tracing_appender::rolling::{RollingFileAppender, Rotation}; | ||
use tracing_subscriber::{ | ||
filter::LevelFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, | ||
filter::LevelFilter, fmt, layer::SubscriberExt, reload::Layer, util::SubscriberInitExt, | ||
EnvFilter, | ||
}; | ||
|
||
const APP_INFO: AppInfo = AppInfo { name: "AiR", author: "[email protected]" }; | ||
|
@@ -44,20 +45,19 @@ fn main() { | |
.build(app_dirs2::get_app_root(AppDataType::UserData, &APP_INFO).unwrap()) | ||
.unwrap(), | ||
); | ||
let filter = | ||
EnvFilter::builder().with_default_directive(LevelFilter::INFO.into()).from_env_lossy(); | ||
let (reloadable_filter, filter_handle) = Layer::new(filter); | ||
let file_layer = fmt::layer().with_ansi(false).with_writer(non_blocking); | ||
let subscriber = tracing_subscriber::registry().with(reloadable_filter).with(file_layer); | ||
#[cfg(feature = "dev")] | ||
let console_layer = fmt::layer(); | ||
let subscriber = tracing_subscriber::registry() | ||
.with( | ||
EnvFilter::builder().with_default_directive(LevelFilter::INFO.into()).from_env_lossy(), | ||
) | ||
.with(file_layer); | ||
#[cfg(feature = "dev")] | ||
let subscriber = subscriber.with(console_layer); | ||
|
||
subscriber.init(); | ||
|
||
#[cfg(not(feature = "dev"))] | ||
panic::set_hook(Box::new(|p| tracing::error!("{p}"))); | ||
air::launch().unwrap(); | ||
air::launch(filter_handle).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters