From 0d5ec3626773edb7d32884c594230c7cc03ae0e7 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 2 Jun 2024 12:53:20 +0200 Subject: Simplify logging init --- src/db/incomes.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/db/incomes.rs') diff --git a/src/db/incomes.rs b/src/db/incomes.rs index e5c3164..97cb2b7 100644 --- a/src/db/incomes.rs +++ b/src/db/incomes.rs @@ -26,7 +26,7 @@ WHERE match res { Ok(count) => count, Err(err) => { - error!("Error counting incomes: {:?}", err); + log::error!("Error counting incomes: {:?}", err); 0 } } @@ -62,7 +62,7 @@ OFFSET ? match res { Ok(incomes) => incomes, Err(err) => { - error!("Error listing incomes: {:?}", err); + log::error!("Error listing incomes: {:?}", err); vec![] } } @@ -73,7 +73,7 @@ pub async fn get_row(pool: &SqlitePool, id: i64) -> i64 { SELECT row FROM ( - SELECT + SELECT ROW_NUMBER () OVER (ORDER BY date DESC) AS row, id FROM @@ -94,7 +94,7 @@ WHERE match res { Ok(count) => count, Err(err) => { - error!("Error getting income row: {:?}", err); + log::error!("Error getting income row: {:?}", err); 1 } } @@ -123,7 +123,7 @@ WHERE match res { Ok(p) => Some(p), Err(err) => { - error!("Error looking for income {}: {:?}", id, err); + log::error!("Error looking for income {}: {:?}", id, err); None } } @@ -147,7 +147,7 @@ VALUES match res { Ok(x) => Some(x.last_insert_rowid()), Err(err) => { - error!("Error creating income: {:?}", err); + log::error!("Error creating income: {:?}", err); None } } @@ -180,7 +180,7 @@ WHERE Ok(ids) => ids, Err(Error::RowNotFound) => vec![], Err(err) => { - error!("Error looking if income is defined: {:?}", err); + log::error!("Error looking if income is defined: {:?}", err); vec![] } } @@ -210,7 +210,7 @@ WHERE match res { Ok(_) => true, Err(err) => { - error!("Error updating income {}: {:?}", id, err); + log::error!("Error updating income {}: {:?}", id, err); false } } @@ -234,7 +234,7 @@ WHERE match res { Ok(_) => true, Err(err) => { - error!("Error deleting income {}: {:?}", id, err); + log::error!("Error deleting income {}: {:?}", id, err); false } } @@ -272,7 +272,7 @@ ON match res { Ok(d) => d, Err(err) => { - error!("Error looking for incomes defined for all: {:?}", err); + log::error!("Error looking for incomes defined for all: {:?}", err); None } } @@ -290,7 +290,7 @@ pub async fn cumulative( match res { Ok(incomes) => HashMap::from_iter(incomes), Err(err) => { - error!("Error computing cumulative income: {:?}", err); + log::error!("Error computing cumulative income: {:?}", err); HashMap::new() } } @@ -435,7 +435,7 @@ FROM match res { Ok(xs) => xs, Err(err) => { - error!("Error listing incomes for statistics: {:?}", err); + log::error!("Error listing incomes for statistics: {:?}", err); vec![] } } @@ -486,7 +486,7 @@ ORDER BY match res { Ok(payments) => payments, Err(err) => { - error!("Error listing payments for report: {:?}", err); + log::error!("Error listing payments for report: {:?}", err); vec![] } } -- cgit v1.2.3