From 4f71b613642172722c8bf15085f4613be37b16b8 Mon Sep 17 00:00:00 2001 From: Grant Colley Date: Thu, 26 Dec 2024 11:52:54 +0000 Subject: [PATCH] Separate Atlas.Core.Logging interface from Serilogs implementation #16 Renamed Atlas.Core.Logging to Atlas.Logging for interfaces only, and created Atlas.Logging.Serilogs for Serilogs implementation #16 --- Atlas.sln | 21 +++++++---- ...cs => 20241225221340_Atlas_01.Designer.cs} | 6 ++-- ...Atlas_01.cs => 20241225221340_Atlas_01.cs} | 7 +--- .../ApplicationDbContextModelSnapshot.cs | 4 +-- src/Atlas.API/Atlas.API.csproj | 9 ++--- .../Endpoints/AdministrationEndpoints.cs | 36 +++++++++---------- .../Endpoints/ApplicationEndpoints.cs | 32 ++++++++--------- src/Atlas.API/Endpoints/ClaimEndpoints.cs | 10 +++--- src/Atlas.API/Endpoints/DeveloperEndpoints.cs | 8 ++--- src/Atlas.API/Endpoints/OptionsEndpoints.cs | 6 ++-- src/Atlas.API/Endpoints/SupportEndpoints.cs | 4 +-- src/Atlas.API/Program.cs | 6 ++-- .../Atlas.Blazor.Web.App.csproj | 9 ++--- .../Components/Layout/NavMenu.razor | 4 +-- .../Components/_Imports.razor | 2 +- src/Atlas.Blazor.Web.App/Program.cs | 5 ++- src/Atlas.Blazor.Web/Atlas.Blazor.Web.csproj | 2 +- .../Components/Base/AtlasComponentBase.cs | 4 +-- .../Generic/GenericGridContainer.razor | 2 +- .../Generic/GenericModelContainer.razor | 2 +- .../Components/Pages/Developer/Database.razor | 6 ++-- .../Components/Pages/Support/Logs.razor | 2 +- src/Atlas.Blazor.Web/_Imports.razor | 4 +-- .../ApplicationDbContext.cs | 2 +- .../Atlas.Data.Access.EF.csproj | 2 +- .../Data/DeveloperData.cs | 22 ++++++------ .../Atlas.Logging.Serilog.csproj | 19 ++++++++++ .../Services/LogService.cs | 4 +-- .../Atlas.Logging.csproj} | 1 - .../Enums/LogLevel.cs | 2 +- .../Interfaces/ILogService.cs | 4 +-- 31 files changed, 133 insertions(+), 114 deletions(-) rename migrations/Atlas.Migrations.SQLServer/Migrations/{20241221210812_Atlas_01.Designer.cs => 20241225221340_Atlas_01.Designer.cs} (99%) rename migrations/Atlas.Migrations.SQLServer/Migrations/{20241221210812_Atlas_01.cs => 20241225221340_Atlas_01.cs} (98%) create mode 100644 src/Atlas.Logging.Serilog/Atlas.Logging.Serilog.csproj rename src/{Atlas.Core.Logging => Atlas.Logging.Serilog}/Services/LogService.cs (96%) rename src/{Atlas.Core.Logging/Atlas.Core.Logging.csproj => Atlas.Logging/Atlas.Logging.csproj} (87%) rename src/{Atlas.Core.Logging => Atlas.Logging}/Enums/LogLevel.cs (70%) rename src/{Atlas.Core.Logging => Atlas.Logging}/Interfaces/ILogService.cs (84%) diff --git a/Atlas.sln b/Atlas.sln index 73c9e26..9e43cc2 100644 --- a/Atlas.sln +++ b/Atlas.sln @@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atlas.Blazor.Web.App.Client EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atlas.Blazor.Web", "src\Atlas.Blazor.Web\Atlas.Blazor.Web.csproj", "{1DA30BB5-2943-42AF-B810-E6E220D658F7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atlas.Core.Logging", "src\Atlas.Core.Logging\Atlas.Core.Logging.csproj", "{D2F67554-D276-4C6D-B033-DC5480F725BA}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "migrations", "migrations", "{5EF3D9C7-E877-425B-95A7-2C21A7407EC6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utility", "utility", "{881E7D01-54E2-4752-BDCF-BEC0D8825534}" @@ -37,6 +35,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlas.Data.Access.EF", "src EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlas.Data.Access.EF.Context", "src\Atlas.Data.Access.EF.Context\Atlas.Data.Access.EF.Context.csproj", "{25952631-4DAD-49A7-B4C7-F819F13CC555}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlas.Logging", "src\Atlas.Logging\Atlas.Logging.csproj", "{C6680503-010B-4AC1-BB2C-D8856E325168}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlas.Logging.Serilog", "src\Atlas.Logging.Serilog\Atlas.Logging.Serilog.csproj", "{8CE1F8A2-40D3-45CC-9B2D-DC526394A8E4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,10 +73,6 @@ Global {1DA30BB5-2943-42AF-B810-E6E220D658F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DA30BB5-2943-42AF-B810-E6E220D658F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DA30BB5-2943-42AF-B810-E6E220D658F7}.Release|Any CPU.Build.0 = Release|Any CPU - {D2F67554-D276-4C6D-B033-DC5480F725BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2F67554-D276-4C6D-B033-DC5480F725BA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2F67554-D276-4C6D-B033-DC5480F725BA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2F67554-D276-4C6D-B033-DC5480F725BA}.Release|Any CPU.Build.0 = Release|Any CPU {CF4F5023-BD96-4A8D-A331-1AF6073CAA84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CF4F5023-BD96-4A8D-A331-1AF6073CAA84}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF4F5023-BD96-4A8D-A331-1AF6073CAA84}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -99,6 +97,14 @@ Global {25952631-4DAD-49A7-B4C7-F819F13CC555}.Debug|Any CPU.Build.0 = Debug|Any CPU {25952631-4DAD-49A7-B4C7-F819F13CC555}.Release|Any CPU.ActiveCfg = Release|Any CPU {25952631-4DAD-49A7-B4C7-F819F13CC555}.Release|Any CPU.Build.0 = Release|Any CPU + {C6680503-010B-4AC1-BB2C-D8856E325168}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6680503-010B-4AC1-BB2C-D8856E325168}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6680503-010B-4AC1-BB2C-D8856E325168}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6680503-010B-4AC1-BB2C-D8856E325168}.Release|Any CPU.Build.0 = Release|Any CPU + {8CE1F8A2-40D3-45CC-9B2D-DC526394A8E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CE1F8A2-40D3-45CC-9B2D-DC526394A8E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CE1F8A2-40D3-45CC-9B2D-DC526394A8E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CE1F8A2-40D3-45CC-9B2D-DC526394A8E4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -111,13 +117,14 @@ Global {603C00D0-2857-4920-947D-8EBFEC3139EF} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} {B24B2EDB-C484-4942-973E-E6510DCA6F9D} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} {1DA30BB5-2943-42AF-B810-E6E220D658F7} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} - {D2F67554-D276-4C6D-B033-DC5480F725BA} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} {CF4F5023-BD96-4A8D-A331-1AF6073CAA84} = {881E7D01-54E2-4752-BDCF-BEC0D8825534} {68D4AF69-D350-4515-AD53-9419D09643B0} = {5EF3D9C7-E877-425B-95A7-2C21A7407EC6} {5FA5960E-01B3-4567-8F19-70A8AA743FE1} = {5EF3D9C7-E877-425B-95A7-2C21A7407EC6} {944113A7-49EA-4B68-917B-B9AC56D1FC12} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} {5B96B25D-0228-4D3E-8EE1-D1D9036796E7} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} {25952631-4DAD-49A7-B4C7-F819F13CC555} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} + {C6680503-010B-4AC1-BB2C-D8856E325168} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} + {8CE1F8A2-40D3-45CC-9B2D-DC526394A8E4} = {4D561DB1-6F2C-4895-88D3-91379F9CFEE6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {35D4493E-72A3-403D-AB40-7AADFBC20D09} diff --git a/migrations/Atlas.Migrations.SQLServer/Migrations/20241221210812_Atlas_01.Designer.cs b/migrations/Atlas.Migrations.SQLServer/Migrations/20241225221340_Atlas_01.Designer.cs similarity index 99% rename from migrations/Atlas.Migrations.SQLServer/Migrations/20241221210812_Atlas_01.Designer.cs rename to migrations/Atlas.Migrations.SQLServer/Migrations/20241225221340_Atlas_01.Designer.cs index 724eda8..c826934 100644 --- a/migrations/Atlas.Migrations.SQLServer/Migrations/20241221210812_Atlas_01.Designer.cs +++ b/migrations/Atlas.Migrations.SQLServer/Migrations/20241225221340_Atlas_01.Designer.cs @@ -12,7 +12,7 @@ namespace Atlas.Migrations.SQLServer.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20241221210812_Atlas_01")] + [Migration("20241225221340_Atlas_01")] partial class Atlas_01 { /// @@ -95,7 +95,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("nvarchar(max)"); b.Property("Message") - .HasColumnType("nvarchar(450)"); + .HasColumnType("nvarchar(max)"); b.Property("MessageTemplate") .HasColumnType("nvarchar(max)"); @@ -114,8 +114,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("Context"); - b.HasIndex("Message"); - b.HasIndex("TimeStamp"); b.HasIndex("User"); diff --git a/migrations/Atlas.Migrations.SQLServer/Migrations/20241221210812_Atlas_01.cs b/migrations/Atlas.Migrations.SQLServer/Migrations/20241225221340_Atlas_01.cs similarity index 98% rename from migrations/Atlas.Migrations.SQLServer/Migrations/20241221210812_Atlas_01.cs rename to migrations/Atlas.Migrations.SQLServer/Migrations/20241225221340_Atlas_01.cs index 3eaf537..a5c3f38 100644 --- a/migrations/Atlas.Migrations.SQLServer/Migrations/20241221210812_Atlas_01.cs +++ b/migrations/Atlas.Migrations.SQLServer/Migrations/20241225221340_Atlas_01.cs @@ -37,7 +37,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Message = table.Column(type: "nvarchar(450)", nullable: true), + Message = table.Column(type: "nvarchar(max)", nullable: true), MessageTemplate = table.Column(type: "nvarchar(max)", nullable: true), Level = table.Column(type: "nvarchar(max)", nullable: true), TimeStamp = table.Column(type: "datetime2", nullable: true), @@ -245,11 +245,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Logs", column: "Context"); - migrationBuilder.CreateIndex( - name: "IX_Logs_Message", - table: "Logs", - column: "Message"); - migrationBuilder.CreateIndex( name: "IX_Logs_TimeStamp", table: "Logs", diff --git a/migrations/Atlas.Migrations.SQLServer/Migrations/ApplicationDbContextModelSnapshot.cs b/migrations/Atlas.Migrations.SQLServer/Migrations/ApplicationDbContextModelSnapshot.cs index 11f1ccd..f5cb7d7 100644 --- a/migrations/Atlas.Migrations.SQLServer/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/migrations/Atlas.Migrations.SQLServer/Migrations/ApplicationDbContextModelSnapshot.cs @@ -92,7 +92,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("nvarchar(max)"); b.Property("Message") - .HasColumnType("nvarchar(450)"); + .HasColumnType("nvarchar(max)"); b.Property("MessageTemplate") .HasColumnType("nvarchar(max)"); @@ -111,8 +111,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Context"); - b.HasIndex("Message"); - b.HasIndex("TimeStamp"); b.HasIndex("User"); diff --git a/src/Atlas.API/Atlas.API.csproj b/src/Atlas.API/Atlas.API.csproj index 6a4aaf5..d39b22d 100644 --- a/src/Atlas.API/Atlas.API.csproj +++ b/src/Atlas.API/Atlas.API.csproj @@ -21,9 +21,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + @@ -32,8 +32,9 @@ - + + diff --git a/src/Atlas.API/Endpoints/AdministrationEndpoints.cs b/src/Atlas.API/Endpoints/AdministrationEndpoints.cs index aea73e1..02a0033 100644 --- a/src/Atlas.API/Endpoints/AdministrationEndpoints.cs +++ b/src/Atlas.API/Endpoints/AdministrationEndpoints.cs @@ -2,9 +2,9 @@ using Atlas.API.Utility; using Atlas.Core.Constants; using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; using Atlas.Core.Models; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; using FluentValidation; using Microsoft.AspNetCore.Mvc; @@ -34,7 +34,7 @@ internal static async Task GetUsers(IAdministrationData administrationD } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -62,7 +62,7 @@ internal static async Task GetUser(int id, IAdministrationData administ } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -92,7 +92,7 @@ internal static async Task CreateUser([FromBody] User user, IValidator< } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -122,7 +122,7 @@ internal static async Task UpdateUser([FromBody] User user, IValidator< } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -150,7 +150,7 @@ internal static async Task DeleteUser(int id, IAdministrationData admin } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -178,7 +178,7 @@ internal static async Task GetRoles(IAdministrationData administrationD } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -206,7 +206,7 @@ internal static async Task GetRole(int id, IAdministrationData administ } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -236,7 +236,7 @@ internal static async Task CreateRole([FromBody] Role role, IValidator< } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -266,7 +266,7 @@ internal static async Task UpdateRole([FromBody] Role role, IValidator< } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -294,7 +294,7 @@ internal static async Task DeleteRole(int id, IAdministrationData admin } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -322,7 +322,7 @@ internal static async Task GetPermissions(IAdministrationData administr } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -350,7 +350,7 @@ internal static async Task GetPermission(int id, IAdministrationData ad } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -380,7 +380,7 @@ internal static async Task CreatePermission([FromBody] Permission permi } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -410,7 +410,7 @@ internal static async Task UpdatePermission([FromBody] Permission permi } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -438,7 +438,7 @@ internal static async Task DeletePermission(int id, IAdministrationData } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -466,7 +466,7 @@ internal static async Task GetPermissionChecklistAsync(IAdministrationD } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -494,7 +494,7 @@ internal static async Task GetRoleChecklistAsync(IAdministrationData ad } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } diff --git a/src/Atlas.API/Endpoints/ApplicationEndpoints.cs b/src/Atlas.API/Endpoints/ApplicationEndpoints.cs index 5cbfc5a..cf23280 100644 --- a/src/Atlas.API/Endpoints/ApplicationEndpoints.cs +++ b/src/Atlas.API/Endpoints/ApplicationEndpoints.cs @@ -2,9 +2,9 @@ using Atlas.API.Utility; using Atlas.Core.Constants; using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; using Atlas.Core.Models; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; using FluentValidation; using Microsoft.AspNetCore.Mvc; @@ -34,7 +34,7 @@ internal static async Task GetModules(IApplicationData applicationData, } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -62,7 +62,7 @@ internal static async Task GetModule(int id, IApplicationData applicati } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -92,7 +92,7 @@ internal static async Task CreateModule([FromBody] Module module, IVali } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -122,7 +122,7 @@ internal static async Task UpdateModule([FromBody] Module module, IVali } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -150,7 +150,7 @@ internal static async Task DeleteModule(int id, IApplicationData applic } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -178,7 +178,7 @@ internal static async Task GetCategories(IApplicationData applicationDa } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -206,7 +206,7 @@ internal static async Task GetCategory(int id, IApplicationData applica } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -236,7 +236,7 @@ internal static async Task CreateCategory([FromBody] Category category, } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -266,7 +266,7 @@ internal static async Task UpdateCategory([FromBody] Category category, } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -294,7 +294,7 @@ internal static async Task DeleteCategory(int id, IApplicationData appl } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -321,7 +321,7 @@ internal static async Task GetPages(IApplicationData applicationData, I } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -349,7 +349,7 @@ internal static async Task GetPage(int id, IApplicationData application } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -379,7 +379,7 @@ internal static async Task CreatePage([FromBody] Page page, IValidator< } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -409,7 +409,7 @@ internal static async Task UpdatePage([FromBody] Page page, IValidator< } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -437,7 +437,7 @@ internal static async Task DeletePage(int id, IApplicationData applicat } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } diff --git a/src/Atlas.API/Endpoints/ClaimEndpoints.cs b/src/Atlas.API/Endpoints/ClaimEndpoints.cs index 8606898..932f0a8 100644 --- a/src/Atlas.API/Endpoints/ClaimEndpoints.cs +++ b/src/Atlas.API/Endpoints/ClaimEndpoints.cs @@ -1,8 +1,8 @@ using Atlas.API.Interfaces; using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; using Atlas.Core.Models; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; namespace Atlas.API.Endpoints { @@ -27,7 +27,7 @@ internal static async Task GetClaimAuthorisation(IClaimData claimData, } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -48,13 +48,13 @@ internal static async Task GetClaimModules(IClaimData claimData, IClaim || ex.Message.Contains("unauthorized")) && claimService.HasDeveloperClaim()) { - logService.Log(Core.Logging.Enums.LogLevel.Information, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Information, ex.Message, ex, authorisation?.User); return Results.Ok(claimData.GetDeveloperDatabaseClaim()); } else { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -74,7 +74,7 @@ internal static async Task GetClaimModules(IClaimData claimData, IClaim } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } diff --git a/src/Atlas.API/Endpoints/DeveloperEndpoints.cs b/src/Atlas.API/Endpoints/DeveloperEndpoints.cs index 7179a92..2f05f5a 100644 --- a/src/Atlas.API/Endpoints/DeveloperEndpoints.cs +++ b/src/Atlas.API/Endpoints/DeveloperEndpoints.cs @@ -1,8 +1,8 @@ using Atlas.API.Interfaces; using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; using Atlas.Core.Models; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; namespace Atlas.API.Endpoints { @@ -28,7 +28,7 @@ internal static async Task GetDatabaseStatus(IDeveloperData developerDa } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, user); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, user); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -54,7 +54,7 @@ internal static async Task CreateDatabase(IDeveloperData developerData, } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, user); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, user); return Results.StatusCode(StatusCodes.Status500InternalServerError); } @@ -80,7 +80,7 @@ internal static async Task SeedDatabase(IDeveloperData developerData, I } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, user); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, user); return Results.StatusCode(StatusCodes.Status500InternalServerError); } diff --git a/src/Atlas.API/Endpoints/OptionsEndpoints.cs b/src/Atlas.API/Endpoints/OptionsEndpoints.cs index 2a3e3f5..69d4706 100644 --- a/src/Atlas.API/Endpoints/OptionsEndpoints.cs +++ b/src/Atlas.API/Endpoints/OptionsEndpoints.cs @@ -1,8 +1,8 @@ using Atlas.API.Interfaces; using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; using Atlas.Core.Models; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; using Microsoft.AspNetCore.Mvc; using System.Text; @@ -31,7 +31,7 @@ internal static async Task GetOptions([FromBody] IEnumerable GetGenericOptions([FromBody] IEnumerable GetLogs([FromBody] string args, ISupportData } catch (AtlasException ex) { - logService.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); + logService.Log(Logging.Enums.LogLevel.Error, ex.Message, ex, authorisation?.User); return Results.StatusCode(StatusCodes.Status500InternalServerError); } diff --git a/src/Atlas.API/Program.cs b/src/Atlas.API/Program.cs index 9d1f3a1..2f21713 100644 --- a/src/Atlas.API/Program.cs +++ b/src/Atlas.API/Program.cs @@ -2,12 +2,14 @@ using Atlas.API.Interfaces; using Atlas.API.Services; using Atlas.Core.Constants; -using Atlas.Core.Logging.Interfaces; -using Atlas.Core.Logging.Services; +using Atlas.Core.Exceptions; using Atlas.Core.Validation.Extensions; using Atlas.Data.Access.EF.Context; using Atlas.Data.Access.EF.Data; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; +using Atlas.Logging.Serilog.Services; +using Atlas.Seed.Data; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Http.Json; using Microsoft.EntityFrameworkCore; diff --git a/src/Atlas.Blazor.Web.App/Atlas.Blazor.Web.App.csproj b/src/Atlas.Blazor.Web.App/Atlas.Blazor.Web.App.csproj index 2408d19..68fa6c5 100644 --- a/src/Atlas.Blazor.Web.App/Atlas.Blazor.Web.App.csproj +++ b/src/Atlas.Blazor.Web.App/Atlas.Blazor.Web.App.csproj @@ -11,15 +11,16 @@ - + + - - - + + + diff --git a/src/Atlas.Blazor.Web.App/Components/Layout/NavMenu.razor b/src/Atlas.Blazor.Web.App/Components/Layout/NavMenu.razor index 9e6affd..e6372fb 100644 --- a/src/Atlas.Blazor.Web.App/Components/Layout/NavMenu.razor +++ b/src/Atlas.Blazor.Web.App/Components/Layout/NavMenu.razor @@ -49,7 +49,7 @@ [Inject] internal IClaimRequests? ClaimRequests { get; set; } - private IEnumerable? _modules = new List(); + private IEnumerable? _modules = null; private PersistingComponentStateSubscription _persistingSubscription; private string? _user = string.Empty; @@ -103,7 +103,7 @@ } catch(Exception ex) { - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); + LoggingService?.Log(Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); Models.Alert alert = new() { diff --git a/src/Atlas.Blazor.Web.App/Components/_Imports.razor b/src/Atlas.Blazor.Web.App/Components/_Imports.razor index aae3397..555e9e7 100644 --- a/src/Atlas.Blazor.Web.App/Components/_Imports.razor +++ b/src/Atlas.Blazor.Web.App/Components/_Imports.razor @@ -19,6 +19,6 @@ @using Atlas.Blazor.Web.Utility @using Atlas.Core.Constants @using Atlas.Core.Exceptions -@using Atlas.Core.Logging.Interfaces @using Atlas.Core.Models +@using Atlas.Logging.Interfaces @using Atlas.Requests.Interfaces diff --git a/src/Atlas.Blazor.Web.App/Program.cs b/src/Atlas.Blazor.Web.App/Program.cs index 8e90802..340dca0 100644 --- a/src/Atlas.Blazor.Web.App/Program.cs +++ b/src/Atlas.Blazor.Web.App/Program.cs @@ -1,13 +1,12 @@ using Atlas.Blazor.Web.App.Authentication; using Atlas.Blazor.Web.App.Components; using Atlas.Blazor.Web.App.Extensions; -using Atlas.Blazor.Web.Constants; using Atlas.Blazor.Web.Interfaces; using Atlas.Blazor.Web.Services; using Atlas.Core.Constants; -using Atlas.Core.Logging.Interfaces; -using Atlas.Core.Logging.Services; using Atlas.Core.Validation.Extensions; +using Atlas.Logging.Interfaces; +using Atlas.Logging.Serilog.Services; using Atlas.Requests.API; using Atlas.Requests.Interfaces; using Auth0.AspNetCore.Authentication; diff --git a/src/Atlas.Blazor.Web/Atlas.Blazor.Web.csproj b/src/Atlas.Blazor.Web/Atlas.Blazor.Web.csproj index 275eb11..4fe0376 100644 --- a/src/Atlas.Blazor.Web/Atlas.Blazor.Web.csproj +++ b/src/Atlas.Blazor.Web/Atlas.Blazor.Web.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Atlas.Blazor.Web/Components/Base/AtlasComponentBase.cs b/src/Atlas.Blazor.Web/Components/Base/AtlasComponentBase.cs index 3c08f05..e2b486c 100644 --- a/src/Atlas.Blazor.Web/Components/Base/AtlasComponentBase.cs +++ b/src/Atlas.Blazor.Web/Components/Base/AtlasComponentBase.cs @@ -1,6 +1,6 @@ using Atlas.Blazor.Web.Constants; using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; +using Atlas.Logging.Interfaces; using Atlas.Requests.Interfaces; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; @@ -52,7 +52,7 @@ protected void RouteAlert(string message, AtlasException? atlasException = null) Message = message }; - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, message, atlasException, User); + LoggingService?.Log(Logging.Enums.LogLevel.Error, message, atlasException, User); NavigationManager?.NavigateTo(alert.Route); } diff --git a/src/Atlas.Blazor.Web/Components/Generic/GenericGridContainer.razor b/src/Atlas.Blazor.Web/Components/Generic/GenericGridContainer.razor index d1affb1..99bcdf3 100644 --- a/src/Atlas.Blazor.Web/Components/Generic/GenericGridContainer.razor +++ b/src/Atlas.Blazor.Web/Components/Generic/GenericGridContainer.razor @@ -151,7 +151,7 @@ else Message = ex.Message }; - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); + LoggingService?.Log(Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); } } diff --git a/src/Atlas.Blazor.Web/Components/Generic/GenericModelContainer.razor b/src/Atlas.Blazor.Web/Components/Generic/GenericModelContainer.razor index 8692ead..11c6990 100644 --- a/src/Atlas.Blazor.Web/Components/Generic/GenericModelContainer.razor +++ b/src/Atlas.Blazor.Web/Components/Generic/GenericModelContainer.razor @@ -208,7 +208,7 @@ if (!string.IsNullOrWhiteSpace(alertType) && (alertType == Alerts.ERROR || alertType == Alerts.WARNING)) { - Core.Logging.Enums.LogLevel logLevel = alertType == Alerts.ERROR ? Core.Logging.Enums.LogLevel.Error : Core.Logging.Enums.LogLevel.Warning; + Logging.Enums.LogLevel logLevel = alertType == Alerts.ERROR ? Logging.Enums.LogLevel.Error : Logging.Enums.LogLevel.Warning; LoggingService?.Log(logLevel, message, ex, _user); } diff --git a/src/Atlas.Blazor.Web/Components/Pages/Developer/Database.razor b/src/Atlas.Blazor.Web/Components/Pages/Developer/Database.razor index 0e35b90..e70740d 100644 --- a/src/Atlas.Blazor.Web/Components/Pages/Developer/Database.razor +++ b/src/Atlas.Blazor.Web/Components/Pages/Developer/Database.razor @@ -118,7 +118,7 @@ else } catch(Exception ex) { - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); + LoggingService?.Log(Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); Models.Alert alert = new() { @@ -162,7 +162,7 @@ else } catch (Exception ex) { - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); + LoggingService?.Log(Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); Models.Alert alert = new() { @@ -206,7 +206,7 @@ else } catch (Exception ex) { - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); + LoggingService?.Log(Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); Models.Alert alert = new() { diff --git a/src/Atlas.Blazor.Web/Components/Pages/Support/Logs.razor b/src/Atlas.Blazor.Web/Components/Pages/Support/Logs.razor index 94f9cd8..1308188 100644 --- a/src/Atlas.Blazor.Web/Components/Pages/Support/Logs.razor +++ b/src/Atlas.Blazor.Web/Components/Pages/Support/Logs.razor @@ -277,7 +277,7 @@ else Message = ex.Message }; - LoggingService?.Log(Core.Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); + LoggingService?.Log(Logging.Enums.LogLevel.Error, ex.Message, new AtlasException(ex.Message, ex), _user); } _isProcessing = false; diff --git a/src/Atlas.Blazor.Web/_Imports.razor b/src/Atlas.Blazor.Web/_Imports.razor index b7e5d85..bae32a6 100644 --- a/src/Atlas.Blazor.Web/_Imports.razor +++ b/src/Atlas.Blazor.Web/_Imports.razor @@ -20,7 +20,7 @@ @using Atlas.Core.Dynamic @using Atlas.Core.Exceptions @using Atlas.Core.Models -@using Atlas.Core.Logging.Enums -@using Atlas.Core.Logging.Interfaces +@using Atlas.Logging.Enums +@using Atlas.Logging.Interfaces @using Atlas.Requests.Interfaces @using Blazored.FluentValidation \ No newline at end of file diff --git a/src/Atlas.Data.Access.EF.Context/ApplicationDbContext.cs b/src/Atlas.Data.Access.EF.Context/ApplicationDbContext.cs index 1c7b390..ab33948 100644 --- a/src/Atlas.Data.Access.EF.Context/ApplicationDbContext.cs +++ b/src/Atlas.Data.Access.EF.Context/ApplicationDbContext.cs @@ -71,7 +71,7 @@ protected override void OnModelCreating(ModelBuilder builder) .HasIndex(l => l.TimeStamp); builder.Entity() - .HasIndex(l => l.Message); + .HasIndex(l => l.User); builder.Entity() .HasIndex(l => l.Context); diff --git a/src/Atlas.Data.Access.EF/Atlas.Data.Access.EF.csproj b/src/Atlas.Data.Access.EF/Atlas.Data.Access.EF.csproj index 298e741..a00faf3 100644 --- a/src/Atlas.Data.Access.EF/Atlas.Data.Access.EF.csproj +++ b/src/Atlas.Data.Access.EF/Atlas.Data.Access.EF.csproj @@ -8,10 +8,10 @@ - + diff --git a/src/Atlas.Data.Access.EF/Data/DeveloperData.cs b/src/Atlas.Data.Access.EF/Data/DeveloperData.cs index ed1f217..d10648e 100644 --- a/src/Atlas.Data.Access.EF/Data/DeveloperData.cs +++ b/src/Atlas.Data.Access.EF/Data/DeveloperData.cs @@ -1,8 +1,8 @@ using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; using Atlas.Core.Models; using Atlas.Data.Access.EF.Context; using Atlas.Data.Access.Interfaces; +using Atlas.Logging.Interfaces; using Atlas.Seed.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; @@ -47,11 +47,11 @@ public class DeveloperData(ApplicationDbContext applicationDbContext, IConfigura if (!databaseStatus.CanConnect) { - _logger.LogDebug($"Creating the Atlas database {_applicationDbContext.Database.GetConnectionString()}"); + logService.Log(Logging.Enums.LogLevel.Information, $"Creating the Atlas database {_applicationDbContext.Database.GetConnectionString()}", user); databaseStatus.CanConnect = await _applicationDbContext.Database.EnsureCreatedAsync(cancellationToken).ConfigureAwait(false); - logService.Log(Core.Logging.Enums.LogLevel.Information, $"Atlas database created {_applicationDbContext.Database.GetConnectionString()}", user); + logService.Log(Logging.Enums.LogLevel.Information, $"Atlas database created {_applicationDbContext.Database.GetConnectionString()}", user); } return databaseStatus; @@ -76,33 +76,33 @@ public class DeveloperData(ApplicationDbContext applicationDbContext, IConfigura if (databaseStatus.CanConnect) { bool generateSeedData = bool.Parse(_configuration["SeedData:GenerateSeedData"] ?? "false"); - bool generateDemoLogs = bool.Parse(_configuration["SeedData:GenerateDemoLogs"] ?? "false"); + bool generateDemoLogs = bool.Parse(_configuration["SeedData:GenerateSeedLogs"] ?? "false"); if (generateSeedData) { SeedData.Generate(_applicationDbContext); - logService.Log(Core.Logging.Enums.LogLevel.Information, $"Atlas database seeded {_applicationDbContext.Database.GetConnectionString()}", user); + logService.Log(Logging.Enums.LogLevel.Information, $"Atlas database seeded {_applicationDbContext.Database.GetConnectionString()}", user); if (generateDemoLogs) { for (int i = 0; i < 500; i++) { - logService.Log(Core.Logging.Enums.LogLevel.Information, new AtlasException("myNumber is zero", new DivideByZeroException(), "myNumber=0"), "test@email.com"); - logService.Log(Core.Logging.Enums.LogLevel.Warning, new AtlasException("myVariable is null", new NullReferenceException("myVariable"), "myVariable=null"), "system@email.com"); - logService.Log(Core.Logging.Enums.LogLevel.Error, new AtlasException("Boom!", new StackOverflowException(), "what the...."), "user@email.com"); + logService.Log(Logging.Enums.LogLevel.Information, new AtlasException("myNumber is zero", new DivideByZeroException(), "myNumber=0"), "test@email.com"); + logService.Log(Logging.Enums.LogLevel.Warning, new AtlasException("myVariable is null", new NullReferenceException("myVariable"), "myVariable=null"), "system@email.com"); + logService.Log(Logging.Enums.LogLevel.Error, new AtlasException("Boom!", new StackOverflowException(), "what the...."), "user@email.com"); } - logService.Log(Core.Logging.Enums.LogLevel.Information, $"Atlas database demo logs created {_applicationDbContext.Database.GetConnectionString()}", user); + logService.Log(Logging.Enums.LogLevel.Information, $"Atlas database demo logs created {_applicationDbContext.Database.GetConnectionString()}", user); } else { - logService.Log(Core.Logging.Enums.LogLevel.Information, "SeedData:GenerateDemoLogs = false", user); + logService.Log(Logging.Enums.LogLevel.Information, "SeedData:GenerateDemoLogs = false", user); } } else { - logService.Log(Core.Logging.Enums.LogLevel.Warning, "SeedData:GenerateSeedData = false", user); + logService.Log(Logging.Enums.LogLevel.Warning, "SeedData:GenerateSeedData = false", user); } } diff --git a/src/Atlas.Logging.Serilog/Atlas.Logging.Serilog.csproj b/src/Atlas.Logging.Serilog/Atlas.Logging.Serilog.csproj new file mode 100644 index 0000000..ceb99cd --- /dev/null +++ b/src/Atlas.Logging.Serilog/Atlas.Logging.Serilog.csproj @@ -0,0 +1,19 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + + + diff --git a/src/Atlas.Core.Logging/Services/LogService.cs b/src/Atlas.Logging.Serilog/Services/LogService.cs similarity index 96% rename from src/Atlas.Core.Logging/Services/LogService.cs rename to src/Atlas.Logging.Serilog/Services/LogService.cs index 73dad0a..a1252a8 100644 --- a/src/Atlas.Core.Logging/Services/LogService.cs +++ b/src/Atlas.Logging.Serilog/Services/LogService.cs @@ -1,9 +1,9 @@ using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Interfaces; +using Atlas.Logging.Interfaces; using Microsoft.Extensions.Logging; using Serilog.Context; -namespace Atlas.Core.Logging.Services +namespace Atlas.Logging.Serilog.Services { public class LogService(ILogger logger) : ILogService { diff --git a/src/Atlas.Core.Logging/Atlas.Core.Logging.csproj b/src/Atlas.Logging/Atlas.Logging.csproj similarity index 87% rename from src/Atlas.Core.Logging/Atlas.Core.Logging.csproj rename to src/Atlas.Logging/Atlas.Logging.csproj index 3a1d220..db0cfaf 100644 --- a/src/Atlas.Core.Logging/Atlas.Core.Logging.csproj +++ b/src/Atlas.Logging/Atlas.Logging.csproj @@ -8,7 +8,6 @@ - diff --git a/src/Atlas.Core.Logging/Enums/LogLevel.cs b/src/Atlas.Logging/Enums/LogLevel.cs similarity index 70% rename from src/Atlas.Core.Logging/Enums/LogLevel.cs rename to src/Atlas.Logging/Enums/LogLevel.cs index 58333f3..bb5044b 100644 --- a/src/Atlas.Core.Logging/Enums/LogLevel.cs +++ b/src/Atlas.Logging/Enums/LogLevel.cs @@ -1,4 +1,4 @@ -namespace Atlas.Core.Logging.Enums +namespace Atlas.Logging.Enums { public enum LogLevel { diff --git a/src/Atlas.Core.Logging/Interfaces/ILogService.cs b/src/Atlas.Logging/Interfaces/ILogService.cs similarity index 84% rename from src/Atlas.Core.Logging/Interfaces/ILogService.cs rename to src/Atlas.Logging/Interfaces/ILogService.cs index 5a2a50a..b66104c 100644 --- a/src/Atlas.Core.Logging/Interfaces/ILogService.cs +++ b/src/Atlas.Logging/Interfaces/ILogService.cs @@ -1,7 +1,7 @@ using Atlas.Core.Exceptions; -using Atlas.Core.Logging.Enums; +using Atlas.Logging.Enums; -namespace Atlas.Core.Logging.Interfaces +namespace Atlas.Logging.Interfaces { public interface ILogService {