aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-01-30 17:04:42 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-01-30 17:04:42 +0000
commit27ff3d00bd770e2ebe2e42acc28356ac5b8efaad (patch)
treeb6b1d2efd2e397d1b9afc30e668f2e068f93a23e /src
parent849a348503ca38c171276f658f1ac4bd273ef2d1 (diff)
downloadblossom-27ff3d00bd770e2ebe2e42acc28356ac5b8efaad.tar.gz
blossom-27ff3d00bd770e2ebe2e42acc28356ac5b8efaad.tar.bz2
blossom-27ff3d00bd770e2ebe2e42acc28356ac5b8efaad.zip
add tracing
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
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))