This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
EventSource implementation #328
Closed
Description
Hi, I created a logger implementation which forwards messages to a System.Diagnostics.Tracing.EventSource and was wondering if this would be interesting for you since EventSource is one of the recommended ways to log in the .NET framework.
https://github.com/cwe1ss/Logging/tree/EventSource/src/Microsoft.Extensions.Logging.EventSource
it has the following features:
- it's a general purpose EventSource called "LoggingEventSource" with the name "Microsoft-Extensions-Logging"
- it has events for every log level (Trace, Debug, ...)
- ILogger.BeginScopeImpl is implemented by calling an ActivityStart and ActivityStop event on the EventSource (which automatically creates an ActivityId)
- ILogValues from the state parameter are stored as a JSON serialized dictionary called "Properties". Right now this uses Newtonsoft.Json - In .NET 4.6 this could be changed to the "rich payload" feature, however most tools seem to not yet support this (Semantic Logging Application Block; Visual Studio "Diagnostic Events" window [from the Azure Service Fabric SDK])
- Exception details are also added as separate properties to this dictionary
If this is interesting for you, I'd be happy to do necessary changes and create a pull request.
@vancem - feedback would be appreciated!
best regards, christian