From 1c851611de827489a9f520ff28cee8fb3c80bab0 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 5 Nov 2024 15:37:25 +0000 Subject: [PATCH] Add namespace and class name to demo project --- .../Program.cs | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Serilog.Enrichers.ClassName.Demo/Program.cs b/src/Serilog.Enrichers.ClassName.Demo/Program.cs index 7c8904c..734dee1 100644 --- a/src/Serilog.Enrichers.ClassName.Demo/Program.cs +++ b/src/Serilog.Enrichers.ClassName.Demo/Program.cs @@ -4,19 +4,25 @@ using Serilog.Enrichers.ClassName; using SerilogDemo; +namespace Demo; -Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() - .Enrich.WithClassName() - .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] [{ClassName}] [{SourceContext}] {Message:lj}{NewLine}{Exception}") - .CreateLogger(); +class MyProgram +{ + public static void Main(string[] args) + { + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .Enrich.WithClassName() + .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] [{ClassName}] [{SourceContext}] {Message:lj}{NewLine}{Exception}") + .CreateLogger(); - Log.Information("Application starting..."); + Log.Information("Application starting..."); -// Log from another class -var demoClass = new DemoClass(); - demoClass.DoWork(); + // Log from another class + var demoClass = new DemoClass(); + demoClass.DoWork(); -Log.Information("Application ending..."); -Log.CloseAndFlush(); - + Log.Information("Application ending..."); + Log.CloseAndFlush(); + } +}