using Serilog.Context; namespace MarcoBMS.Services.Service { public class LoggingService : ILoggingService { private readonly ILogger _logger; public LoggingService(ILogger logger) { _logger = logger; } public void LogError(string? message, params object[]? args) { using (LogContext.PushProperty("LogLevel", "Error")) if (args != null) { _logger.LogError(message, args); } else { _logger.LogError(message); } } public void LogInfo(string? message, params object[]? args) { using (LogContext.PushProperty("LogLevel", "Information")) if (args != null) { _logger.LogInformation(message, args); } else { _logger.LogInformation(message); } } public void LogWarning(string? message, params object[]? args) { using (LogContext.PushProperty("LogLevel", "Warning")) if (args != null) { _logger.LogWarning(message, args); } else { _logger.LogWarning(message); } } } }