您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

44 行
1.4 KiB

  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. }