Merge pull request '#199 Les logs des repository sont desormais disponibles sur la console et dans grafana pour faciliter le debuggage.' (#206) from j3/fix_operations_admin into dev

Reviewed-on: https://10.4.0.131/gitea/DI1-P4-E1/Webzine/pulls/206
This commit is contained in:
j.vetu
2026-04-06 19:42:19 +02:00
3 changed files with 5 additions and 11 deletions

View File

@@ -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");

View File

@@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Webzine.Repository": "Debug"
}
},
"Webzine": {

View File

@@ -29,6 +29,7 @@
<rules>
<!-- Vos logs d'application en Debug+ -->
<logger name="Webzine.WebApplication.*" minlevel="Info" writeTo="allfile,ownfile-web,console" />
<logger name="Webzine.Repository.*" minlevel="Debug" writeTo="allfile,ownfile-web,console" />
<!-- Logs Microsoft en Warning+ sauf Hosting.Lifetime -->
<logger name="Microsoft.*" minlevel="Warn" writeTo="allfile" final="true" />