Skip to content

Commit

Permalink
show line number in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
techgarage-ir committed Jan 2, 2025
1 parent 74168c2 commit 06836e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Application/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using MTWireGuard.Application.Models.Mikrotik;
using MTWireGuard.Application.Repositories;
using Serilog;
using Serilog.Enrichers.CallerInfo;
using Serilog.Events;
using Serilog.Exceptions;
using Serilog.Exceptions.Core;
Expand Down Expand Up @@ -267,8 +268,13 @@ public static Serilog.Core.Logger LoggerConfiguration()
{
return new LoggerConfiguration()
.Enrich.WithExceptionDetails(new DestructuringOptionsBuilder()
.WithDefaultDestructurers()
.WithRootName("Message").WithRootName("Exception").WithRootName("Exception"))
.WithDefaultDestructurers()
.WithRootName("Message").WithRootName("Exception").WithRootName("Exception"))
.Enrich.WithCallerInfo(
includeFileInfo: true,
assemblyPrefix: "MTWireGuard.",
prefix: "Log.Source_",
filePathDepth: 10)
.Enrich.WithProperty("App.Version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "0.0.0.0")
.Enrich.WithMachineName()
.Enrich.WithEnvironmentUserName()
Expand Down
1 change: 1 addition & 0 deletions Application/MTWireGuard.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Enrichers.CallerInfo" Version="1.0.5" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
Expand Down

0 comments on commit 06836e1

Please sign in to comment.