diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 25bc21f..de9b7ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use poem::{ get, handler, listener::TcpListener, middleware::AddData, + middleware::Tracing, web::{Data, Path, Query}, EndpointExt, Route, Server, }; @@ -25,6 +26,7 @@ use rust_embed::RustEmbed; use error::BlossomError; use serde::Deserialize; +use tracing_subscriber::FmtSubscriber; type Result<T> = std::result::Result<T, BlossomError>; @@ -124,8 +126,12 @@ async fn custom_error(err: poem::Error) -> impl IntoResponse { #[tokio::main] async fn main() -> std::result::Result<(), std::io::Error> { + let subscriber = FmtSubscriber::new(); + tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed"); + // let mut skinny_data = mastodon_async::Data::default(); // skinny_data.base = Cow::from("https://skinnyver.se"); + let blossom = Route::new() .at("/", get(home)) .at("/blog", get(get_blog)) @@ -135,6 +141,7 @@ async fn main() -> std::result::Result<(), std::io::Error> { .at("/plants", get(plants)) .nest("/static/", EmbeddedFilesEndpoint::<Static>::new()) .catch_all_error(custom_error) + .with(Tracing) .with(AddData::new( reqwest::Client::builder() .connect_timeout(Duration::from_secs(1)) |