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.
 
 
 
 

26 lines
800 B

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