Module: WinRM::Transport::Logging

Included in:
CommandExecutor, FileTransporter, TmpZip
Defined in:
lib/winrm/transport/logging.rb

Overview

Mixin to use an optionally provided logger for logging.

Author:

Instance Method Summary collapse

Instance Method Details

#debug(msg = nil) { ... } ⇒ Object

Logs a message on the logger at the debug level, if a logger is present.

Parameters:

  • msg (String) (defaults to: nil)

    a message to log

Yields:

  • evaluates and uses return value as message to log. If msg parameter is set, it will take precedence over the block.



34
35
36
37
# File 'lib/winrm/transport/logging.rb', line 34

def debug(msg = nil, &block)
  return if logger.nil? || !logger.debug?
  logger.debug("[#{log_subject}] " << (msg || block.call))
end

#log_subjectString

The subject for log messages.

Returns:

  • (String)

    log subject



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

def log_subject
  @log_subject ||= self.class.to_s.split("::").last
end