You've already forked AstralRinth
forked from didirus/AstralRinth
* Make theseus capable of logging messages from the `log` crate * Move update checking entirely into JS and open a modal if an update is available * Fix formatjs on Windows and run formatjs * Add in the buttons and body * Fix lint * Show update size in modal * Fix update not being rechecked if the update modal was directly dismissed * Slight UI tweaks * Fix lint * Implement skipping the update * Implement the Update Now button * Implement updating at next exit * Turn download progress into an error bar on failure * Restore 5 minute update check instead of 30 seconds * Fix PendingUpdateData being seen as a unit struct * Fix lint * Make CI also lint updater code * feat: create AppearingProgressBar component * feat: polish update available modal * feat: add error handling * Open changelog with tauri-plugin-opener * Run intl:extract * Update completion toasts (#3978) * Use single LAUNCHER_USER_AGENT constant for all user agents * Fix build on Mac * Request the update size with HEAD instead of GET * UI tweaks * lint * Fix lint * fix: hide modal header & add "Hide update reminder" button w/ tooltip * Run intl:extract * fix: lint issues * fix: merge issues * notifications.js no longer exists * Add metered network checking * Add a timeout to macOS is_network_metered * Fix tauri.conf.json * vibe debugging * Set a dispatch queue * Have a popup that asks you if you'd like to disable automatic file downloads if you're on a metered network * Move UpdateModal to modal package * Fix lint * Add a toggle for automatic downloads * Fix type Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com> Signed-off-by: Josiah Glosson <soujournme@gmail.com> * Redo updating UI and experience * lint * fix unlistener issue * remove unneeded translation keys * Fix expose issue * temp disable cranelift, tweak some messages * change version back * Clean up App.vue * move toast to top right * update reload icon * Fixed the bug!!!!!!!!!!!! * improve messages * intl:extract * Add liquid glass icon file * not you! * use dependency injection * lint on apple icon * Fix imports, move download size to button * change update check back to 5 mins * lint + move to providers * intl:extract --------- Signed-off-by: Cal H. <hendersoncal117@gmail.com> Signed-off-by: Josiah Glosson <soujournme@gmail.com> Co-authored-by: Calum <calum@modrinth.com> Co-authored-by: Prospector <prospectordev@gmail.com> Co-authored-by: Cal H. <hendersoncal117@gmail.com> Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com> Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
91 lines
3.1 KiB
Rust
91 lines
3.1 KiB
Rust
/*
|
|
tracing is set basd on the environment variable RUST_LOG=xxx, depending on the amount of logs to show
|
|
ERROR > WARN > INFO > DEBUG > TRACE
|
|
eg. RUST_LOG=info will show info, warn, and error logs
|
|
RUST_LOG="theseus=trace" will show *all* messages but from theseus only (and not dependencies using similar crates)
|
|
RUST_LOG="theseus=trace" will show *all* messages but from theseus only (and not dependencies using similar crates)
|
|
|
|
Error messages returned to Tauri will display as traced error logs if they return an error.
|
|
This will also include an attached span trace if the error is from a tracing error, and the level is set to info, debug, or trace
|
|
|
|
on unix:
|
|
RUST_LOG="theseus=trace" {run command}
|
|
|
|
The default is theseus=show, meaning only logs from theseus will be displayed, and at the info or higher level.
|
|
|
|
*/
|
|
|
|
// Handling for the live development logging
|
|
// This will log to the console, and will not log to a file
|
|
#[cfg(debug_assertions)]
|
|
pub fn start_logger() -> Option<()> {
|
|
use tracing_subscriber::prelude::*;
|
|
|
|
let filter = tracing_subscriber::EnvFilter::try_from_default_env()
|
|
.unwrap_or_else(|_| {
|
|
tracing_subscriber::EnvFilter::new("theseus=info,theseus_gui=info")
|
|
});
|
|
tracing_subscriber::registry()
|
|
.with(tracing_subscriber::fmt::layer())
|
|
.with(filter)
|
|
.with(tracing_error::ErrorLayer::default())
|
|
.init();
|
|
Some(())
|
|
}
|
|
|
|
// Handling for the live production logging
|
|
// This will log to a file in the logs directory, and will not show any logs in the console
|
|
#[cfg(not(debug_assertions))]
|
|
pub fn start_logger() -> Option<()> {
|
|
use crate::prelude::DirectoryInfo;
|
|
use chrono::Local;
|
|
use std::fs::OpenOptions;
|
|
use tracing_subscriber::fmt::time::ChronoLocal;
|
|
use tracing_subscriber::prelude::*;
|
|
|
|
// Initialize and get logs directory path
|
|
let logs_dir = if let Some(d) = DirectoryInfo::launcher_logs_dir() {
|
|
d
|
|
} else {
|
|
eprintln!("Could not start logger");
|
|
return None;
|
|
};
|
|
|
|
let log_file_name =
|
|
format!("session_{}.log", Local::now().format("%Y%m%d_%H%M%S"));
|
|
let log_file_path = logs_dir.join(log_file_name);
|
|
|
|
if let Err(err) = std::fs::create_dir_all(&logs_dir) {
|
|
eprintln!("Could not create logs directory: {err}");
|
|
}
|
|
|
|
let file = match OpenOptions::new()
|
|
.create(true)
|
|
.write(true)
|
|
.append(true)
|
|
.open(&log_file_path)
|
|
{
|
|
Ok(file) => file,
|
|
Err(e) => {
|
|
eprintln!("Could not start open log file: {e}");
|
|
return None;
|
|
}
|
|
};
|
|
|
|
let filter = tracing_subscriber::EnvFilter::try_from_default_env()
|
|
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("theseus=info"));
|
|
|
|
tracing_subscriber::registry()
|
|
.with(
|
|
tracing_subscriber::fmt::layer()
|
|
.with_writer(file)
|
|
.with_ansi(false) // disable ANSI escape codes
|
|
.with_timer(ChronoLocal::rfc_3339()),
|
|
)
|
|
.with(filter)
|
|
.with(tracing_error::ErrorLayer::default())
|
|
.init();
|
|
|
|
Some(())
|
|
}
|