Add /log page that displays server log

This will eventually be behind an authorization guard so that only I
have access, but it's useful to have for monitoring and testing out
turbo streams.
This commit is contained in:
2023-06-03 01:09:25 -04:00
parent ea236dff4e
commit 951d6d23e2
11 changed files with 141 additions and 9 deletions

13
src/handlers/log.rs Normal file
View File

@@ -0,0 +1,13 @@
use axum::response::Response;
use maud::html;
use crate::error::Result;
use crate::partials::layout::Layout;
use crate::log::MEM_LOG;
pub async fn get(layout: Layout) -> Result<Response> {
let mem_buf = MEM_LOG.lock().unwrap();
Ok(layout.render(html! {
pre { (std::str::from_utf8(mem_buf.as_slices().0).unwrap()) }
}))
}

View File

@@ -2,3 +2,4 @@ pub mod api;
pub mod entry;
pub mod home;
pub mod feeds;
pub mod log;