Changed --debug
behavior to only affect stdout debug/info messages
This commit is contained in:
parent
5ad110a9b4
commit
82fdb7b2a2
3 changed files with 4 additions and 5 deletions
|
@ -13,6 +13,7 @@ pub use prettify_bytes::prettify_bytes;
|
||||||
|
|
||||||
pub const APP_ID: &str = "moe.launcher.an-anime-game-launcher-gtk";
|
pub const APP_ID: &str = "moe.launcher.an-anime-game-launcher-gtk";
|
||||||
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
|
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
pub const APP_DEBUG: bool = cfg!(debug_assertions);
|
||||||
|
|
||||||
/// Sets to `true` when the `App` component is ready (fully initialized)
|
/// Sets to `true` when the `App` component is ready (fully initialized)
|
||||||
pub static mut READY: bool = false;
|
pub static mut READY: bool = false;
|
||||||
|
@ -24,8 +25,6 @@ pub fn is_ready() -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
pub static ref APP_DEBUG: bool = cfg!(debug_assertions) || std::env::args().any(|arg| &arg == "--debug");
|
|
||||||
|
|
||||||
/// Config loaded on the app's start. Use `config::get()` to get up to date config instead.
|
/// Config loaded on the app's start. Use `config::get()` to get up to date config instead.
|
||||||
/// This one is used to prepare some launcher UI components on start
|
/// This one is used to prepare some launcher UI components on start
|
||||||
pub static ref CONFIG: config::Config = config::get().expect("Failed to load config");
|
pub static ref CONFIG: config::Config = config::get().expect("Failed to load config");
|
||||||
|
@ -59,7 +58,7 @@ lazy_static::lazy_static! {
|
||||||
fn main() {
|
fn main() {
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
.with_span_events(tracing_subscriber::fmt::format::FmtSpan::FULL)
|
.with_span_events(tracing_subscriber::fmt::format::FmtSpan::FULL)
|
||||||
.with_max_level(if *APP_DEBUG {
|
.with_max_level(if APP_DEBUG || std::env::args().any(|arg| &arg == "--debug") {
|
||||||
tracing::Level::TRACE
|
tracing::Level::TRACE
|
||||||
} else {
|
} else {
|
||||||
tracing::Level::WARN
|
tracing::Level::WARN
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl SimpleComponent for AboutDialog {
|
||||||
|
|
||||||
set_version: &{
|
set_version: &{
|
||||||
// Debug build & build's version doesn't contain any suffix (-dev, -beta, etc)
|
// Debug build & build's version doesn't contain any suffix (-dev, -beta, etc)
|
||||||
if *crate::APP_DEBUG && !crate::APP_VERSION.contains('-') {
|
if crate::APP_DEBUG && !crate::APP_VERSION.contains('-') {
|
||||||
format!("{}-dev", crate::APP_VERSION)
|
format!("{}-dev", crate::APP_VERSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ impl SimpleComponent for App {
|
||||||
|
|
||||||
let widgets = view_output!();
|
let widgets = view_output!();
|
||||||
|
|
||||||
if *crate::APP_DEBUG {
|
if crate::APP_DEBUG {
|
||||||
widgets.main_window.add_css_class("devel");
|
widgets.main_window.add_css_class("devel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue