diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2023-03-21 09:31:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 08:31:36 +0000 |
commit | 36fdc302bef162d213d6a026c99614673b24a069 (patch) | |
tree | cadbdda49542ddf5234040206676a186ebe9b440 /src-tauri/src/main.rs | |
parent | 25791906cc8c81368af5718f8ec6ee8b4f428b31 (diff) | |
download | FlightCore-36fdc302bef162d213d6a026c99614673b24a069.tar.gz FlightCore-36fdc302bef162d213d6a026c99614673b24a069.zip |
feat: Proper logging (#223)
* feat: Initial setup of sentry logging
* refactor: Replace some println with log call
Not replacing all cause too large diff
Diffstat (limited to 'src-tauri/src/main.rs')
-rw-r--r-- | src-tauri/src/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 50e439c8..0733d5a0 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -45,6 +45,14 @@ use tokio::time::sleep; struct Counter(Arc<Mutex<i32>>); fn main() { + // Setup logger + let mut log_builder = pretty_env_logger::formatted_builder(); + log_builder.parse_filters("info"); + let logger = sentry_log::SentryLogger::with_dest(log_builder.build()); + + log::set_boxed_logger(Box::new(logger)).unwrap(); + log::set_max_level(log::LevelFilter::Info); + // Only enable Sentry crash logs on release #[cfg(not(debug_assertions))] let _guard = sentry::init(( @@ -222,10 +230,10 @@ async fn check_is_northstar_outdated( let version_number = convert_release_candidate_number(version_number); if version_number != nmod.latest { - println!("Installed Northstar version outdated"); + log::info!("Installed Northstar version outdated"); Ok(true) } else { - println!("Installed Northstar version up-to-date"); + log::info!("Installed Northstar version up-to-date"); Ok(false) } } @@ -353,7 +361,8 @@ async fn get_server_player_count() -> Result<(i32, usize), String> { // Sum up player count let total_player_count: i32 = ns_servers.iter().map(|server| server.player_count).sum(); - dbg!((total_player_count, server_count)); + log::info!("total_player_count: {}", total_player_count); + log::info!("server_count: {}", server_count); Ok((total_player_count, server_count)) } |