Существует ли какой-либо пакет для NLog, который предлагает встроенную интеграцию в модель журнала .NET DiagnosticSource?Вроде как NLogTraceListener ...
Ничего не вижу в Google на первый взгляд.
Может быть, вы можете просто выполнить DiagnosticListener.AllListeners.Subscribe и затем переслать в NLog-Logger:
DiagnosticListener.AllListeners.Subscribe(delegate(DiagnosticListener listener) { // subscribe to the Service Bus DiagnosticSource if (listener.Name == "Microsoft.Azure.ServiceBus") { // receive event from Service Bus DiagnosticSource listener.Subscribe(delegate(KeyValuePair<string, object> @event) { // Log operation details once it's done if (!@event.Key.EndsWith("Stop")) return; var currentActivity = Activity.Current; NLogLogger.Debug($"{currentActivity.OperationName} Duration: {currentActivity.Duration}\n\t{string.Join("\n\t", currentActivity.Tags)}"); }); } });
https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md#discovery-of-diagnosticlisteners
https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/develop/Src/Web/Web/AspNetDiagnosticTelemetryModule.cs