fix logging issues
ci/woodpecker/push/e2e Pipeline was successful
ci/woodpecker/push/fmt Pipeline failed
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
2026-08-01 23:42:26 -04:00
parent a7544f837e
commit 51dcff1202
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ Open <http://127.0.0.1:3000>. The application creates `sustenance.db` in the wor
| `COOKIE_SECURE` | `false` | Add the `Secure` attribute to session cookies |
| `REGISTRATION_MODE` | `invite_only` | Use `open` for local development; otherwise registration requires a valid list invitation after the first account |
| `SEED_CONFIG` | `seed.json` | Optional JSON file with a default user to create when the database is first initialized |
| `RUST_LOG` | `sustenance=debug,tower_http=info` | Log filter |
| `RUST_LOG` | `sustenance=info,tower_http=info` | Log filter; HTTP requests are logged at info level |
### Seeding a default user
+11 -3
View File
@@ -16,8 +16,12 @@ use axum::{
use futures_util::{SinkExt, StreamExt};
use serde::{Deserialize, de::DeserializeOwned};
use thiserror::Error;
use tower_http::{services::ServeDir, set_header::SetResponseHeaderLayer, trace::TraceLayer};
use tracing::{error, warn};
use tower_http::{
services::ServeDir,
set_header::SetResponseHeaderLayer,
trace::{DefaultMakeSpan, DefaultOnResponse, TraceLayer},
};
use tracing::{error, warn, Level};
use crate::domain::{DomainError, SessionUser};
use crate::ports::{HubEvent, RealtimeNotifier};
@@ -104,7 +108,11 @@ pub fn build_router(state: AppState) -> Router {
))
.service(ServeDir::new("static")),
)
.layer(TraceLayer::new_for_http())
.layer(
TraceLayer::new_for_http()
.make_span_with(DefaultMakeSpan::new().level(Level::INFO))
.on_response(DefaultOnResponse::new().level(Level::INFO)),
)
.layer(middleware::from_fn(log_response_status))
.with_state(state)
}
+1 -1
View File
@@ -34,7 +34,7 @@ use crate::sqlite::{
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter(
env::var("RUST_LOG").unwrap_or_else(|_| "sustenance=debug,tower_http=info".into()),
env::var("RUST_LOG").unwrap_or_else(|_| "sustenance=info,tower_http=info".into()),
)
.init();