Module: Proxy::RemoteExecution::Ssh::Runners::CommandLogging
- Included in:
- MultiplexedSSHConnection, ScriptRunner
- Defined in:
- lib/smart_proxy_remote_execution_ssh/command_logging.rb
Instance Method Summary collapse
- #log_command(command, label: "Running") ⇒ Object
- #set_pm_debug_logging(pm, capture: false, user_method: nil) ⇒ Object
Instance Method Details
#log_command(command, label: "Running") ⇒ Object
5 6 7 8 9 |
# File 'lib/smart_proxy_remote_execution_ssh/command_logging.rb', line 5 def log_command(command, label: "Running") command = command.join(' ') label = "#{label}: " if label logger.debug("#{label}#{command}") end |
#set_pm_debug_logging(pm, capture: false, user_method: nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/smart_proxy_remote_execution_ssh/command_logging.rb', line 11 def set_pm_debug_logging(pm, capture: false, user_method: nil) callback = proc do |data| data.each_line do |line| logger.debug(line.chomp) if user_method.nil? || !user_method.filter_password?(line) user_method.on_data(data, pm.stdin) if user_method end data end pm.on_stdout(&callback) pm.on_stderr(&callback) end |