module ModBus::Debug

Attributes

logger[RW]
raise_exception_on_mismatch[RW]
read_retries[RW]
read_retry_timeout[RW]

Private Instance Methods

log(msg) click to toggle source

Put log message on standard output @param [String] msg message for log

# File lib/rmodbus/debug.rb, line 13
def log(msg)
  logger&.debug(msg)
end
logging_bytes(msg) click to toggle source

Convert string of byte to string for log @example

logging_bytes("\x1\xa\x8") => "[01][0a][08]"

@param [String] msg input string @return [String] readable string of bytes

# File lib/rmodbus/debug.rb, line 22
def logging_bytes(msg)
  msg.unpack("H*").first.gsub(/\X{2}/, "[\\0]")
end