[LOGGING] Fix #25: Standardisation formats logs - JSON en prod/staging, console/texte en dev - Documenté et confirmé

This commit is contained in:
senke 2025-12-27 01:55:10 +01:00
parent e0e76c1f49
commit 524a35ce51
2 changed files with 6 additions and 3 deletions

View file

@ -1,7 +1,8 @@
/**
* FIX #18, #19, #22: Logger structuré pour le frontend
* FIX #18, #19, #22, #25: Logger structuré pour le frontend
* - Support de la corrélation avec request_id
* - Logs structurés en JSON en production
* - Logs structurés en JSON en production (FIX #25: Standardisé)
* - Format texte en développement pour lisibilité
* - Filtrage selon l'environnement
*/
@ -67,8 +68,9 @@ function formatLog(
const logContext = { ...globalContext, ...context };
const timestamp = new Date().toISOString();
// FIX #25: Standardiser sur JSON en production pour faciliter l'agrégation
if (isProd) {
// En production : JSON structuré
// En production : JSON structuré (standardisé pour agrégation)
const logEntry = {
timestamp,
level,

View file

@ -88,6 +88,7 @@ pub fn init_with_config(config: LoggingConfig) -> VezaResult<()> {
let env_filter = EnvFilter::try_from_default_env()
.unwrap_or_else(|_| EnvFilter::new(&log_level));
// FIX #25: Standardiser sur JSON en production/staging, texte en développement
// Create formatting layer based on format
let fmt_layer = match config.format.as_str() {
"json" => fmt::layer()