style(logging): Ensured that all logs start with lowercase capital and have no trailing punctuation

This commit is contained in:
quexeky
2025-01-19 20:36:38 +11:00
parent 5bb04dafdd
commit cfc9d13cad
16 changed files with 38 additions and 41 deletions

View File

@ -26,7 +26,7 @@
import { XCircleIcon } from "@heroicons/vue/16/solid";
const route = useRoute();
const message = route.query.error ?? "An unknown error occurred.";
const message = route.query.error ?? "An unknown error occurred";
definePageMeta({
layout: "mini",

View File

@ -320,7 +320,7 @@ const installDir = ref(0);
async function install() {
try {
if (!versionOptions.value)
throw new Error("Versions have not been loaded.");
throw new Error("Versions have not been loaded");
installLoading.value = true;
await invoke("download_game", {
gameId: game.value.id,

View File

@ -254,7 +254,7 @@ async function submitDirectory() {
try {
error.value = undefined;
if (!currentDirectory.value)
throw new Error("Please select a directory first.");
throw new Error("Please select a directory first");
createDirectoryLoading.value = true;
// Add directory

View File

@ -7,10 +7,10 @@ pub fn toggle_autostart_logic(app: AppHandle, enabled: bool) -> Result<(), Strin
let manager = app.autolaunch();
if enabled {
manager.enable().map_err(|e| e.to_string())?;
debug!("Enabled autostart");
debug!("enabled autostart");
} else {
manager.disable().map_err(|e| e.to_string())?;
debug!("Disabled autostart");
debug!("eisabled autostart");
}
// Store the state in DB
@ -56,10 +56,10 @@ pub fn sync_autostart_on_startup(app: &AppHandle) -> Result<(), String> {
if current_state != should_be_enabled {
if should_be_enabled {
manager.enable().map_err(|e| e.to_string())?;
debug!("Synced autostart: enabled");
debug!("synced autostart: enabled");
} else {
manager.disable().map_err(|e| e.to_string())?;
debug!("Synced autostart: disabled");
debug!("synced autostart: disabled");
}
}

View File

@ -9,13 +9,13 @@ pub fn quit(app: tauri::AppHandle, state: tauri::State<'_, std::sync::Mutex<AppS
}
pub fn cleanup_and_exit(app: &AppHandle, state: &tauri::State<'_, std::sync::Mutex<AppState<'_>>>) {
debug!("Cleaning up and exiting application");
debug!("cleaning up and exiting application");
let download_manager = state.lock().unwrap().download_manager.clone();
match download_manager.ensure_terminated() {
Ok(res) => {
match res {
Ok(_) => debug!("Download manager terminated correctly"),
Err(_) => error!("Download manager failed to terminate correctly"),
Ok(_) => debug!("download manager terminated correctly"),
Err(_) => error!("download manager failed to terminate correctly"),
}
},
Err(e) => panic!("{:?}", e),

View File

@ -66,7 +66,7 @@ pub fn update_settings(new_settings: Value) {
}
let new_settings: Settings = serde_json::from_value(current_settings).unwrap();
db_lock.settings = new_settings;
println!("New Settings: {:?}", db_lock.settings);
println!("new Settings: {:?}", db_lock.settings);
}
#[tauri::command]
pub fn fetch_settings() -> Settings {

View File

@ -130,7 +130,7 @@ impl DatabaseImpls for DatabaseInterface {
let games_base_dir = data_root_dir.join("games");
let logs_root_dir = data_root_dir.join("logs");
debug!("Creating data directory at {:?}", data_root_dir);
debug!("creating data directory at {:?}", data_root_dir);
create_dir_all(data_root_dir.clone()).unwrap();
create_dir_all(games_base_dir.clone()).unwrap();
create_dir_all(logs_root_dir.clone()).unwrap();

View File

@ -179,13 +179,13 @@ impl DownloadManagerBuilder {
}
}
fn manage_queue_signal(&mut self, download_agent: DownloadAgent) {
debug!("Got signal Queue");
debug!("got signal Queue");
let meta = download_agent.metadata();
debug!("Queue metadata: {:?}", meta);
debug!("queue metadata: {:?}", meta);
if self.download_queue.exists(meta.clone()) {
warn!("Download with same ID already exists");
warn!("download with same ID already exists");
return;
}
@ -199,7 +199,7 @@ impl DownloadManagerBuilder {
}
fn manage_go_signal(&mut self) {
debug!("Got signal Go");
debug!("got signal Go");
if self.download_agent_registry.is_empty() {
debug!(
"Download agent registry: {:?}",
@ -265,7 +265,7 @@ impl DownloadManagerBuilder {
active_control_flag.set(DownloadThreadControlFlag::Go);
}
fn manage_stop_signal(&mut self) {
debug!("Got signal Stop");
debug!("got signal Stop");
if let Some(active_control_flag) = self.active_control_flag.clone() {
self.set_status(DownloadManagerStatus::Paused);
@ -305,7 +305,7 @@ impl DownloadManagerBuilder {
self.download_queue.pop_front();
self.cleanup_current_download();
debug!("Current download queue: {:?}", self.download_queue.read());
debug!("current download queue: {:?}", self.download_queue.read());
}
// TODO: Collapse these two into a single if statement somehow
else if let Some(download_agent) = self.download_agent_registry.get(meta) {

View File

@ -22,11 +22,11 @@ impl Display for ApplicationDownloadError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
ApplicationDownloadError::Communication(error) => write!(f, "{}", error),
ApplicationDownloadError::Setup(error) => write!(f, "An error occurred while setting up the download: {}", error),
ApplicationDownloadError::Lock => write!(f, "Failed to acquire lock. Something has gone very wrong internally. Please restart the application"),
ApplicationDownloadError::Checksum => write!(f, "Checksum failed to validate for download"),
ApplicationDownloadError::Setup(error) => write!(f, "an error occurred while setting up the download: {}", error),
ApplicationDownloadError::Lock => write!(f, "failed to acquire lock. Something has gone very wrong internally. Please restart the application"),
ApplicationDownloadError::Checksum => write!(f, "checksum failed to validate for download"),
ApplicationDownloadError::IoError(error) => write!(f, "{}", error),
ApplicationDownloadError::DownloadError => write!(f, "Download failed. See Download Manager status for specific error"),
ApplicationDownloadError::DownloadError => write!(f, "download failed. See Download Manager status for specific error"),
}
}
}

View File

@ -40,17 +40,17 @@ impl Display for RemoteAccessError {
RemoteAccessError::ParsingError(parse_error) => {
write!(f, "{}", parse_error)
}
RemoteAccessError::InvalidEndpoint => write!(f, "Invalid drop endpoint"),
RemoteAccessError::HandshakeFailed(message) => write!(f, "Failed to complete handshake: {}", message),
RemoteAccessError::GameNotFound => write!(f, "Could not find game on server"),
RemoteAccessError::InvalidResponse(error) => write!(f, "Server returned an invalid response: {} {}", error.status_code, error.status_message),
RemoteAccessError::InvalidRedirect => write!(f, "Server redirect was invalid"),
RemoteAccessError::InvalidEndpoint => write!(f, "invalid drop endpoint"),
RemoteAccessError::HandshakeFailed(message) => write!(f, "failed to complete handshake: {}", message),
RemoteAccessError::GameNotFound => write!(f, "could not find game on server"),
RemoteAccessError::InvalidResponse(error) => write!(f, "server returned an invalid response: {} {}", error.status_code, error.status_message),
RemoteAccessError::InvalidRedirect => write!(f, "server redirect was invalid"),
RemoteAccessError::ManifestDownloadFailed(status, response) => write!(
f,
"Failed to download game manifest: {} {}",
"failed to download game manifest: {} {}",
status, response
),
RemoteAccessError::OutOfSync => write!(f, "Server's and client's time are out of sync. Please ensure they are within at least 30 seconds of each other."),
RemoteAccessError::OutOfSync => write!(f, "server's and client's time are out of sync. Please ensure they are within at least 30 seconds of each other"),
RemoteAccessError::Generic(message) => write!(f, "{}", message),
}
}

View File

@ -8,7 +8,7 @@ pub enum SetupError {
impl Display for SetupError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
SetupError::Context => write!(f, "Failed to generate contexts for download"),
SetupError::Context => write!(f, "failed to generate contexts for download"),
}
}
}

View File

@ -178,11 +178,8 @@ impl GameDownloadAgent {
let chunk_count = contexts.iter().map(|chunk| chunk.length).sum();
debug!("Setting ProgressObject max to {}", chunk_count);
self.progress.set_max(chunk_count);
debug!("Setting ProgressObject size to {}", length);
self.progress.set_size(length);
debug!("Setting ProgressObject time to now");
self.progress.set_time_now();
}

View File

@ -151,7 +151,7 @@ pub fn download_game_chunk(
let content_length = response.content_length();
if content_length.is_none() {
warn!("Recieved 0 length content from server");
warn!("recieved 0 length content from server");
return Err(ApplicationDownloadError::Communication(
RemoteAccessError::InvalidResponse(response.json().unwrap()),
));

View File

@ -205,7 +205,7 @@ pub fn fetch_game_verion_options_logic(
}
pub fn uninstall_game_logic(meta: DownloadableMetadata, app_handle: &AppHandle) {
println!("Triggered uninstall for agent");
println!("triggered uninstall for agent");
let mut db_handle = DB.borrow_data_mut().unwrap();
db_handle
.applications

View File

@ -121,7 +121,7 @@ fn setup(handle: AppHandle) -> AppState<'static> {
let download_manager = Arc::new(DownloadManagerBuilder::build(handle.clone()));
let process_manager = Arc::new(Mutex::new(ProcessManager::new(handle.clone())));
debug!("Checking if database is set up");
debug!("checking if database is set up");
let is_set_up = DB.database_is_set_up();
if !is_set_up {
return AppState {
@ -133,7 +133,7 @@ fn setup(handle: AppHandle) -> AppState<'static> {
};
}
debug!("Database is set up");
debug!("database is set up");
// TODO: Account for possible failure
let (app_status, user) = auth::setup();
@ -183,7 +183,7 @@ fn setup(handle: AppHandle) -> AppState<'static> {
// Sync autostart state
if let Err(e) = autostart::sync_autostart_on_startup(&handle) {
warn!("Failed to sync autostart state: {}", e);
warn!("failed to sync autostart state: {}", e);
}
AppState {
@ -320,7 +320,7 @@ pub fn run() {
}
_ => {
println!("Menu event not handled: {:?}", event.id);
println!("menu event not handled: {:?}", event.id);
}
})
.build(app)

View File

@ -111,7 +111,7 @@ fn recieve_handshake_logic(app: &AppHandle, path: String) -> Result<(), RemoteAc
let endpoint = base_url.join("/api/v1/client/auth/handshake")?;
let client = reqwest::blocking::Client::new();
let response = client.post(endpoint).json(&body).send()?;
debug!("Handshake responsded with {}", response.status().as_u16());
debug!("handshake responsded with {}", response.status().as_u16());
let response_struct: HandshakeResponse = response.json()?;
{
@ -166,7 +166,7 @@ pub fn auth_initiate_logic() -> Result<(), RemoteAccessError> {
if response.status() != 200 {
let data: DropServerError = response.json()?;
error!("Could not start handshake: {}", data.status_message);
error!("could not start handshake: {}", data.status_message);
return Err(RemoteAccessError::HandshakeFailed(data.status_message));
}