Skip to content

Commit 0db4189

Browse files
BROKERS: Implement Logging
1 parent b8abbbb commit 0db4189

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//-----------------------------------------------------------
2+
// Copyright (c) Coalition of Good-Hearted Engineers
3+
// Free To Use To Build Reliable Library Management Solutions
4+
//-----------------------------------------------------------
5+
6+
namespace LibraryManagement.Api.Brokers.Loggings
7+
{
8+
public interface ILoggingBroker
9+
{
10+
void LogError(Exception exception);
11+
void LogCritical(Exception exception);
12+
}
13+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//-----------------------------------------------------------
2+
// Copyright (c) Coalition of Good-Hearted Engineers
3+
// Free To Use To Build Reliable Library Management Solutions
4+
//-----------------------------------------------------------
5+
6+
namespace LibraryManagement.Api.Brokers.Loggings
7+
{
8+
public class LoggingBroker : ILoggingBroker
9+
{
10+
private readonly ILogger<LoggingBroker> logger;
11+
12+
public LoggingBroker(ILogger<LoggingBroker> logger) =>
13+
this.logger = logger;
14+
15+
public void LogError(Exception exception) =>
16+
this.logger.LogError(exception, exception.Message);
17+
18+
public void LogCritical(Exception exception) =>
19+
this.logger.LogCritical(exception, exception.Message);
20+
}
21+
}

0 commit comments

Comments
 (0)