- 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.
28 lines
804 B
C#
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);
|
|
}
|
|
}
|
|
} |