nreco / logging

Generic file logger for .NET Core (FileLoggerProvider) with minimal dependencies
MIT License
284 stars 56 forks source link

Add scope support #20

Closed TIPConsulting closed 3 years ago

TIPConsulting commented 3 years ago

I have implemented scope support using a combination of code from the following: https://www.meziantou.net/asp-net-core-json-logger.htm https://www.codeproject.com/Articles/1556475/How-to-Write-a-Custom-Logging-Provider-in-ASP-NET

In addition, my new additions follow the 3 scope semantics outlined in this blog: https://nblumhardt.com/2016/11/ilogger-beginscope/

I have also included full xml comments and doc file. I also took the liberty of adding SourceLink configuration to allow downstream implementers to step through this project with a debugger if needed.

There are no breaking changes. All old tests still pass with no modifications. I have added new tests to demonstrate the use of scopes. By default, the standard logging output is unchanged. Users may write scope information to output by setting a custom callback for FileLoggerOptions.FormatLogEntry

VitaliyMF commented 3 years ago

I've reviewed your changes and here are my notes: