25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

MqttNetChildLoggerWrapper.cs 1.4 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using MQTTnet.Diagnostics;
  3. namespace MQTTnet.Server.Logging
  4. {
  5. public class MqttNetChildLoggerWrapper : IMqttNetChildLogger
  6. {
  7. private readonly MqttNetLoggerWrapper _logger;
  8. private readonly string _source;
  9. public MqttNetChildLoggerWrapper(string source, MqttNetLoggerWrapper logger)
  10. {
  11. _logger = logger ?? throw new ArgumentNullException(nameof(logger));
  12. _source = source;
  13. }
  14. public IMqttNetChildLogger CreateChildLogger(string source = null)
  15. {
  16. return _logger.CreateChildLogger(source);
  17. }
  18. public void Verbose(string message, params object[] parameters)
  19. {
  20. _logger.Publish(MqttNetLogLevel.Verbose, _source, message, parameters, null);
  21. }
  22. public void Info(string message, params object[] parameters)
  23. {
  24. _logger.Publish(MqttNetLogLevel.Info, _source, message, parameters, null);
  25. }
  26. public void Warning(Exception exception, string message, params object[] parameters)
  27. {
  28. _logger.Publish(MqttNetLogLevel.Warning, _source, message, parameters, exception);
  29. }
  30. public void Error(Exception exception, string message, params object[] parameters)
  31. {
  32. _logger.Publish(MqttNetLogLevel.Error, _source, message, parameters, exception);
  33. }
  34. }
  35. }