mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-31 14:52:46 -07:00
Create logger service (#101)
* feat: create logger service * feat: opt out __tuono/data routes from logger * feat: update version to v0.12.1
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
use crate::{ssr::Js, Payload};
|
||||
use axum::extract::{Path, Request};
|
||||
use axum::response::Html;
|
||||
use colored::*;
|
||||
use std::collections::HashMap;
|
||||
use tokio::time::Instant;
|
||||
|
||||
pub async fn catch_all(
|
||||
Path(params): Path<HashMap<String, String>>,
|
||||
request: Request,
|
||||
) -> Html<String> {
|
||||
let start = Instant::now();
|
||||
let pathname = request.uri();
|
||||
let headers = request.headers();
|
||||
|
||||
@@ -20,18 +17,6 @@ pub async fn catch_all(
|
||||
|
||||
let result = Js::render_to_string(Some(&payload));
|
||||
|
||||
let duration = start.elapsed();
|
||||
|
||||
// TODO: handle 404 error on catch_all route
|
||||
let http_code = "200";
|
||||
|
||||
println!(
|
||||
" GET {} {} in {}ms",
|
||||
req.uri.path(),
|
||||
http_code.green(),
|
||||
duration.as_millis()
|
||||
);
|
||||
|
||||
match result {
|
||||
Ok(html) => Html(html),
|
||||
_ => Html("500 internal server error".to_string()),
|
||||
|
||||
Reference in New Issue
Block a user