Replace println!()s with logging macros

This commit is contained in:
Kitaiti Makoto
2021-01-05 21:41:14 +09:00
parent ee96d2b754
commit becb40544c
7 changed files with 21 additions and 14 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
use crate::template_utils::{IntoContext, Ructe};
use tracing::warn;
use plume_models::{Error, PlumeRocket};
use rocket::{
response::{self, Responder},
@@ -49,7 +50,7 @@ pub fn server_error(req: &Request<'_>) -> Ructe {
#[post("/csrf-violation?<target>")]
pub fn csrf_violation(target: Option<String>, rockets: PlumeRocket) -> Ructe {
if let Some(uri) = target {
eprintln!("Csrf violation while accessing \"{}\"", uri)
warn!("Csrf violation while accessing \"{}\"", uri)
}
render!(errors::csrf(&rockets.to_context()))
}
+2 -1
View File
@@ -1,5 +1,6 @@
use crate::routes::RespondOrRedirect;
use lettre::Transport;
use tracing::warn;
use rocket::http::ext::IntoOwned;
use rocket::{
http::{uri::Uri, Cookie, Cookies, SameSite},
@@ -155,7 +156,7 @@ pub fn password_reset_request(
) {
if let Some(ref mut mail) = *mail.lock().unwrap() {
mail.send(message.into())
.map_err(|_| eprintln!("Couldn't send password reset email"))
.map_err(|_| warn!("Couldn't send password reset email"))
.ok();
}
}
+3 -2
View File
@@ -3,6 +3,7 @@ use activitypub::{
collection::{OrderedCollection, OrderedCollectionPage},
};
use diesel::SaveChangesDsl;
use tracing::{info, warn};
use rocket::{
http::{ContentType, Cookies},
request::LenientForm,
@@ -67,9 +68,9 @@ pub fn details(
Ok(article) => {
Post::from_activity(&fetch_rockets, article)
.expect("Article from remote user couldn't be saved");
println!("Fetched article from remote user");
info!("Fetched article from remote user");
}
Err(e) => println!("Error while fetching articles in background: {:?}", e),
Err(e) => warn!("Error while fetching articles in background: {:?}", e),
}
}
});