diff --git a/LibraryManagement.Api/Brokers/Loggings/ILoggingBroker.cs b/LibraryManagement.Api/Brokers/Loggings/ILoggingBroker.cs new file mode 100644 index 0000000..708c744 --- /dev/null +++ b/LibraryManagement.Api/Brokers/Loggings/ILoggingBroker.cs @@ -0,0 +1,13 @@ +//----------------------------------------------------------- +// Copyright (c) Coalition of Good-Hearted Engineers +// Free To Use To Build Reliable Library Management Solutions +//----------------------------------------------------------- + +namespace LibraryManagement.Api.Brokers.Loggings +{ + public interface ILoggingBroker + { + void LogError(Exception exception); + void LogCritical(Exception exception); + } +} diff --git a/LibraryManagement.Api/Brokers/Loggings/LoggingBroker.cs b/LibraryManagement.Api/Brokers/Loggings/LoggingBroker.cs new file mode 100644 index 0000000..6bd5647 --- /dev/null +++ b/LibraryManagement.Api/Brokers/Loggings/LoggingBroker.cs @@ -0,0 +1,21 @@ +//----------------------------------------------------------- +// Copyright (c) Coalition of Good-Hearted Engineers +// Free To Use To Build Reliable Library Management Solutions +//----------------------------------------------------------- + +namespace LibraryManagement.Api.Brokers.Loggings +{ + public class LoggingBroker : ILoggingBroker + { + private readonly ILogger logger; + + public LoggingBroker(ILogger logger) => + this.logger = logger; + + public void LogError(Exception exception) => + this.logger.LogError(exception, exception.Message); + + public void LogCritical(Exception exception) => + this.logger.LogCritical(exception, exception.Message); + } +}