You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
713 B

  1. using System;
  2. using MQTTnet.Diagnostics.Logger;
  3. namespace MQTTnet.Tests.Mockups
  4. {
  5. public sealed class TestLogger : IMqttNetLogger
  6. {
  7. public event EventHandler<MqttNetLogMessagePublishedEventArgs> LogMessagePublished;
  8. public bool IsEnabled { get; } = true;
  9. public void Publish(MqttNetLogLevel logLevel, string source, string message, object[] parameters, Exception exception)
  10. {
  11. LogMessagePublished?.Invoke(this, new MqttNetLogMessagePublishedEventArgs(new MqttNetLogMessage
  12. {
  13. Level = logLevel,
  14. Message = string.Format(message, parameters),
  15. Exception = exception
  16. }));
  17. }
  18. }
  19. }