public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { if (formatter == null) { throw new ArgumentNullException(nameof(formatter)); } if (!MqttNetTrace.HasListeners) { return; } var message = formatter(state, exception); var traceMessage = new MqttNetTraceMessage(DateTime.Now, Environment.CurrentManagedThreadId, _categoryName, logLevel, message, exception); _mqttNetTrace.Publish(traceMessage); }
public MqttNetTraceMessagePublishedEventArgs(MqttNetTraceMessage traceMessage) { TraceMessage = traceMessage ?? throw new ArgumentNullException(nameof(traceMessage)); }
public void Publish(MqttNetTraceMessage traceMessage) { TraceMessagePublished?.Invoke(this, new MqttNetTraceMessagePublishedEventArgs(traceMessage)); }