<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.4.0-preview1-25214-03" />

System.Diagnostics

Namespace with 3 public types

Classes

 Activity Activity represents operation with context to be used for logging. Activity has operation name, Id, start time and duration, tags and baggage. Current activity can be accessed with static AsyncLocal variable Activity.Current. Activities should be created with constructor, configured as necessary and then started with Activity.Start method which maintains parent-child relationships for the activities and sets Activity.Current. When activity is finished, it should be stopped with static Activity.Stop method. No methods on Activity allow exceptions to escape as a response to bad inputs. They are thrown and caught (that allows Debuggers and Monitors to see the error) but the exception is supressed, and the operation does something reasonable (typically doing nothing).
 DiagnosticListener A DiagnosticListener is something that forwards on events written with DiagnosticSource. It is an IObservable (has Subscribe method), and it also has a Subscribe overloads that lets you specify a 'IsEnabled' predicate that users of DiagnosticSource will use for 'quick checks'. The item in the stream is a KeyValuePair[string, object] where the string is the name of the diagnostic item and the object is the payload (typically an anonymous type). There may be many DiagnosticListeners in the system, but we encourage the use of The DiagnosticSource.DefaultSource which goes to the DiagnosticListener.DefaultListener. If you need to see 'everything' you can subscribe to the 'AllListeners' event that will fire for every live DiagnosticListener in the appdomain (past or present). Please See the DiagnosticSource Users Guide https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md for instructions on its use.

Abstract Classes

 DiagnosticSource This is the basic API to 'hook' parts of the framework. It is like an EventSource (which can also write object), but is intended to log complex objects that can't be serialized. Please See the DiagnosticSource Users Guide https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md for instructions on its use.