Developer 02 197db1e08b refactor: Entfernen des App Loggers und Implementierung des ILogger-Interfaces; Konfiguration der API für NLog
- App Logger entfernt und durch die Implementierung des `ILogger`-Interfaces ersetzt, um eine konsistente Logging-Architektur zu gewährleisten.
- API für die Nutzung von NLog konfiguriert, um eine leistungsstarke und flexible Logging-Lösung bereitzustellen.
- Konfigurationsdateien und Setup-Anpassungen für die Integration von NLog in die API vorgenommen.
2024-08-27 19:41:12 +02:00

28 lines
804 B
C#

using HRD.WebApi.DAL;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
namespace HRD.WebApi.Controllers
{
[Route("api/[controller]")]
[Produces("application/json")]
[ApiController]
public abstract class BaseMiniController : Microsoft.AspNetCore.Mvc.Controller
{
protected readonly ILogger _logger;
public readonly WebApiBaseContext Context;
public BaseMiniController(WebApiBaseContext webApiBaseContext, ILogger logger)
{
Context = webApiBaseContext;
_logger = logger;
}
[NonAction]
public void WriteLogException(Exception exception, String entityMessage = null)
{
_logger.LogError(exception, "{entityMessage}", entityMessage);
}
}
}