lib/testlab/utility/logger.rb in testlab-0.6.6 vs lib/testlab/utility/logger.rb in testlab-0.6.7
- old
+ new
@@ -6,24 +6,28 @@
# Logger Module
#
# @author Zachary Patten <zachary AT jovelabs DOT com>
module Logger
+ require 'socket'
require 'active_support/version'
def log_key_value(key, value, max_key_length)
" %s%s: %s" % [ key.upcase, '.' * (max_key_length - key.length), value.to_s ]
end
def log_page_break(max_key_length, char='-')
(char * max_key_length)
end
- def log_details
+ def log_details(testlab)
@command = ZTK::Command.new(:silence => true, :ignore_exit_status => true)
{
+ "hostname" => Socket.gethostname.inspect,
"program" => $0.to_s.inspect,
+ "config_dir" => testlab.config_dir.inspect,
+ "logdev" => testlab.ui.logger.logdev.inspect,
"vagrant_version" => @command.exec(%(/usr/bin/env vagrant --version)).output.strip.inspect,
"virtualbox_version" => @command.exec(%(/usr/bin/env vboxmanage --version)).output.strip.inspect
}
end
@@ -46,13 +50,13 @@
"ztk_version" => ::ZTK::VERSION.inspect,
"activesupport_version" => ::ActiveSupport::VERSION::STRING.inspect,
}
end
- def log_header
+ def log_header(testlab)
log_lines = Array.new
- details_hash = log_details
+ details_hash = log_details(testlab)
ruby_hash = log_ruby
dependencies_hash = log_dependencies
max_key_length = [details_hash.keys, ruby_hash.keys, dependencies_hash.keys].flatten.compact.map(&:length).max + 2
max_value_length = [details_hash.values, ruby_hash.values, dependencies_hash.values].flatten.compact.map(&:length).max + 2