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:
13
src/handlers/log.rs
Normal file
13
src/handlers/log.rs
Normal 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()) }
|
||||
}))
|
||||
}
|
||||
@@ -2,3 +2,4 @@ pub mod api;
|
||||
pub mod entry;
|
||||
pub mod home;
|
||||
pub mod feeds;
|
||||
pub mod log;
|
||||
|
||||
Reference in New Issue
Block a user