Wraps Serilog behind an abstract Logger class where debug logging is not compiled into your code when building in Release mode (using [Conditional("DEBUG")]).
dotnet add package TCSystem.Logging- Abstract
Loggerclass with conditional debug logging - Namespace-scoped logging via static
Log.csper namespace - Console, file, and debug output sinks
- Async sink support for non-blocking log writes
- Thread enrichment for log context
- Serilog
- Serilog.Enrichers.Thread
- Serilog.Sinks.Async
- Serilog.Sinks.Console
- Serilog.Sinks.Debug
- Serilog.Sinks.File
- netstandard2.1
- net8.0
- net10.0
Factory.InitLogging(Factory.LoggingOptions.Console | Factory.LoggingOptions.File,
"Output.txt", 1, 10 * 1024);namespace Hello.World;
internal static class Log
{
public static Logger Instance { get; } = Factory.GetLogger(typeof(Log));
}Log.Instance.Info("Hello World");
Log.Instance.Debug("This is only compiled in Debug builds");