feat: JSON-Logging mit Correlation-ID, Anfrage-Log und Audit (M2.4)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -3,9 +3,10 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::Json;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::extract::{Extension, Path, State};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::access::{AccessSlot, clip};
|
||||
use crate::auth::Authed;
|
||||
use crate::error::ApiError;
|
||||
use crate::state::AppState;
|
||||
@ -20,7 +21,7 @@ pub async fn list(
|
||||
Authed(key): Authed,
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
let models = state.store().list_models(true).map_err(|e| {
|
||||
eprintln!("FEHLER Modellliste: {e}");
|
||||
tracing::error!(fehler = %e, "Modellliste nicht lesbar");
|
||||
ApiError::internal()
|
||||
})?;
|
||||
let data: Vec<Value> = models
|
||||
@ -34,10 +35,12 @@ pub async fn list(
|
||||
pub async fn retrieve(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Authed(key): Authed,
|
||||
Extension(slot): Extension<AccessSlot>,
|
||||
Path(id): Path<String>,
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
slot.lock().unwrap_or_else(|e| e.into_inner()).model = Some(clip(&id));
|
||||
let models = state.store().list_models(true).map_err(|e| {
|
||||
eprintln!("FEHLER Modellliste: {e}");
|
||||
tracing::error!(fehler = %e, "Modellliste nicht lesbar");
|
||||
ApiError::internal()
|
||||
})?;
|
||||
if key.rights.allows(&id) && models.iter().any(|m| m.name == id) {
|
||||
|
||||
Reference in New Issue
Block a user