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); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,15 @@ | ||||
| using Core.Blueprint.DAL.Logs.Contracts; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
|  | ||||
| namespace Core.Blueprint.DAL.Logs.Configuration | ||||
| { | ||||
|     public static class LogExtensionConfiguration | ||||
|     { | ||||
|         public static IServiceCollection AddLogLayer(this IServiceCollection services) | ||||
|         { | ||||
|             services.AddScoped<IBlueprintSerilogLogger, BlueprintSerilogLogger>(); | ||||
|  | ||||
|             return services; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								Core.Blueprint.DAL.Logs/Contracts/IBlueprintLogger.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Core.Blueprint.DAL.Logs/Contracts/IBlueprintLogger.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| namespace Core.Blueprint.DAL.Logs.Contracts | ||||
| { | ||||
|     public interface IBlueprintLogger<T> where T : class, new() | ||||
|     { | ||||
|         //logger | ||||
|         //serilog... | ||||
|         //patterns of structuie logging | ||||
|     } | ||||
| } | ||||
							
								
								
									
										12
									
								
								Core.Blueprint.DAL.Logs/Contracts/IBlueprintSerilogLogger.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Core.Blueprint.DAL.Logs/Contracts/IBlueprintSerilogLogger.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| namespace Core.Blueprint.DAL.Logs.Contracts | ||||
| { | ||||
|     public interface IBlueprintSerilogLogger | ||||
|     { | ||||
|         public void LogInformation(string service, params object[] args); | ||||
|         public void LogOperationStarted(string service, params object[] args); | ||||
|         public void LogOperationFinished(string service, params object[] args); | ||||
|         public void LogWarning(string message, params object[] args); | ||||
|         public void LogError(string servicee, params object[] args); | ||||
|         public void LogCritical(Exception exception, string message, params object[] args); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										14
									
								
								Core.Blueprint.DAL.Logs/Core.Blueprint.DAL.Logs.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Core.Blueprint.DAL.Logs/Core.Blueprint.DAL.Logs.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>net8.0</TargetFramework> | ||||
|     <ImplicitUsings>enable</ImplicitUsings> | ||||
|     <Nullable>enable</Nullable> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" /> | ||||
|     <PackageReference Include="Serilog" Version="4.2.0" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| </Project> | ||||
							
								
								
									
										24
									
								
								Core.Blueprint.DAL.Logs/Log.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Core.Blueprint.DAL.Logs/Log.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| namespace Core.Blueprint.DAL.Logs; | ||||
| public static partial class Log | ||||
| { | ||||
|     //[LoggerMessage( | ||||
|     //    EventId = 1, | ||||
|     //    Level = LogLevel.Information, | ||||
|     //    Message = "Starting operation in`{service}` service with parameters: {@Args}" | ||||
|     //)] | ||||
|     //static partial void OperationStarted(ILogger logger, string service, params object[] args); | ||||
|  | ||||
|     //[LoggerMessage( | ||||
|     //    EventId = 1, | ||||
|     //    Level = LogLevel.Information, | ||||
|     //    Message = "Operation finished in`{service}` service with parameters: {@Args}" | ||||
|     //)] | ||||
|     //static partial void OperationFinished(ILogger logger, string service, params object[] args); | ||||
|  | ||||
|     //[LoggerMessage( | ||||
|     //    EventId = 2, | ||||
|     //    Level = LogLevel.Error, | ||||
|     //    Message = "An error occurred in `{service}` service" | ||||
|     //)] | ||||
|     //static partial void OperationFailed(ILogger logger, string service, Exception exception); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin