diff options
author | elijah <elijah@riseup.net> | 2016-06-29 13:49:53 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2016-07-01 14:48:42 -0700 |
commit | 67c0610ee049a388d8ffd0a0e3912ee0d5d9a957 (patch) | |
tree | 4f93935b3fba993bf27b8150a1c8f816ab940045 /lib | |
parent | ed485bd0bab7ccf12679f6847a4687f722323e36 (diff) |
ssh logging: set the correct host
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/ssh/formatter.rb | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/leap_cli/ssh/formatter.rb b/lib/leap_cli/ssh/formatter.rb index 84a8e797..bab43011 100644 --- a/lib/leap_cli/ssh/formatter.rb +++ b/lib/leap_cli/ssh/formatter.rb @@ -22,25 +22,20 @@ module LeapCli end def write(obj) - @logger.log(obj.to_s, :host => @host) + @logger.log(obj.to_s, :host => @host.hostname) end def log_command_start(command) if @options[:log_cmd] - @logger.log(:running, "`" + command.to_s + "`", :host => @host) + @logger.log(:running, "`" + command.to_s + "`", :host => @host.hostname) end end def log_command_data(command, stream_type, stream_data) if @options[:log_output] - color = \ - case stream_type - when :stdout then :cyan - when :stderr then :red - else raise "Unrecognised stream_type #{stream_type}, expected :stdout or :stderr" - end + color = stream_type == :stderr ? :red : nil @logger.log(stream_data.to_s.chomp, - :color => color, :host => @host, :wrap => options[:log_wrap]) + :color => color, :host => @host.hostname, :wrap => options[:log_wrap]) end end @@ -49,10 +44,10 @@ module LeapCli runtime = sprintf('%5.3fs', command.runtime) if command.failure? message = "in #{runtime} with status #{command.exit_status}." - @logger.log(:failed, message, :host => @host) + @logger.log(:failed, message, :host => @host.hostname) else message = "in #{runtime}." - @logger.log(:completed, message, :host => @host) + @logger.log(:completed, message, :host => @host.hostname) end end end |