Module: Mosquitto::Logging

Included in:
Client
Defined in:
lib/mosquitto/logging.rb

Constant Summary collapse

LOG_LEVELS =
{
  Mosquitto::LOG_ERR => Logger::FATAL,
  Mosquitto::LOG_ERR => Logger::ERROR,
  Mosquitto::LOG_WARNING => Logger::WARN,
  Mosquitto::LOG_INFO => Logger::INFO,
  Mosquitto::LOG_DEBUG => Logger::DEBUG
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



12
13
14
# File 'lib/mosquitto/logging.rb', line 12

def logger
  @logger
end

Instance Method Details

#log(message, severity = Logger::DEBUG) ⇒ Object

Pipe debug messages through an already assigned logger instance.

Examples:

client.log("message")

Parameters:



42
43
44
# File 'lib/mosquitto/logging.rb', line 42

def log(message, severity = Logger::DEBUG)
  logger.add(severity, message.to_s, "MQTT") if logger
end