예제 #1
0
        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);
        }
예제 #2
0
 public MqttNetTraceMessagePublishedEventArgs(MqttNetTraceMessage traceMessage)
 {
     TraceMessage = traceMessage ?? throw new ArgumentNullException(nameof(traceMessage));
 }
예제 #3
0
 public void Publish(MqttNetTraceMessage traceMessage)
 {
     TraceMessagePublished?.Invoke(this, new MqttNetTraceMessagePublishedEventArgs(traceMessage));
 }