From 9430c54b82d93cddea0873083d1df263d518672f Mon Sep 17 00:00:00 2001 From: "josephine.vetu" Date: Mon, 6 Apr 2026 19:40:43 +0200 Subject: [PATCH] #199 Les logs des repository sont desormais disponibles sur la console et dans grafana pour faciliter le debuggage. --- .../Administration/Controllers/ArtisteController.cs | 12 ++---------- Webzine.WebApplication/appsettings.json | 3 ++- Webzine.WebApplication/nlog.config | 1 + 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Webzine.WebApplication/Areas/Administration/Controllers/ArtisteController.cs b/Webzine.WebApplication/Areas/Administration/Controllers/ArtisteController.cs index 9442b48..fd3d7f2 100644 --- a/Webzine.WebApplication/Areas/Administration/Controllers/ArtisteController.cs +++ b/Webzine.WebApplication/Areas/Administration/Controllers/ArtisteController.cs @@ -81,16 +81,8 @@ public class ArtisteController : Controller Biographie = model.Biographie, }; - try - { - this.artisteRepository.Add(artiste); - this.logger.LogInformation("Création d'un nouvel artiste: {Nom}", artiste.Nom); - } - catch (Exception ex) - { - this.logger.LogError(ex, "Erreur lors de la création de l'artiste: {Nom}", artiste.Nom); - return this.View(model); - } + this.artisteRepository.Add(artiste); + this.logger.LogInformation("Création d'un nouvel artiste: {Nom}", artiste.Nom); // Renvoyer sur la page Index. return this.RedirectToAction("Index"); diff --git a/Webzine.WebApplication/appsettings.json b/Webzine.WebApplication/appsettings.json index cc61318..a3604ad 100644 --- a/Webzine.WebApplication/appsettings.json +++ b/Webzine.WebApplication/appsettings.json @@ -2,7 +2,8 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Microsoft.AspNetCore": "Warning", + "Webzine.Repository": "Debug" } }, "Webzine": { diff --git a/Webzine.WebApplication/nlog.config b/Webzine.WebApplication/nlog.config index c2ba55e..2ff20bb 100644 --- a/Webzine.WebApplication/nlog.config +++ b/Webzine.WebApplication/nlog.config @@ -29,6 +29,7 @@ +