Add project files.
This commit is contained in:
50
Core.Blueprint.DAL.Logs/BlueprintSerilogLogger.cs
Normal file
50
Core.Blueprint.DAL.Logs/BlueprintSerilogLogger.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Core.Blueprint.DAL.Logs.Contracts;
|
||||
using Serilog;
|
||||
|
||||
namespace Core.Blueprint.DAL.Logs
|
||||
{
|
||||
public class BlueprintSerilogLogger : IBlueprintSerilogLogger
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
|
||||
public BlueprintSerilogLogger(ILogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void LogInformation(string service, params object[] args)
|
||||
{
|
||||
logger.Information("Starting operation in {service} service", service, args);
|
||||
}
|
||||
|
||||
public void LogOperationStarted(string service, params object[] args)
|
||||
{
|
||||
logger.Information("Starting operation in {Service} service with parameters: {@Args}", service, args);
|
||||
}
|
||||
public void LogOperationFinished(string service, params object[] args)
|
||||
{
|
||||
logger.Information("Finishing operation in {Service} service with parameters: {@Args}", service, args);
|
||||
}
|
||||
|
||||
public void LogInformation(string message)
|
||||
{
|
||||
logger.Information(message);
|
||||
}
|
||||
|
||||
public void LogWarning(string message, params object[] args)
|
||||
{
|
||||
logger.Warning(message, args);
|
||||
}
|
||||
|
||||
public void LogError(string service, params object[] args)
|
||||
{
|
||||
logger.Error("An error occurred in `{service}` Exception: {@Args}", service, args);
|
||||
}
|
||||
|
||||
public void LogCritical(Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.Fatal(exception, message, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user