Log all console output
This commit is contained in:
parent
8248679fab
commit
be3f7ffbfc
|
@ -107,12 +107,15 @@ module Vagrant
|
|||
return @_home_path if defined?(@_home_path)
|
||||
|
||||
@_home_path ||= Pathname.new(File.expand_path(ENV["VAGRANT_HOME"] || DEFAULT_HOME))
|
||||
logger.info "Home path: #{@_home_path}"
|
||||
|
||||
# This is the old default that Vagrant used to be put things into
|
||||
# up until Vagrant 0.8.0. We keep around an automatic migration
|
||||
# script here in case any old users upgrade.
|
||||
old_home = File.expand_path("~/.vagrant")
|
||||
if File.exists?(old_home) && File.directory?(old_home)
|
||||
logger.info "Found both an old and new Vagrantfile. Migration initiated."
|
||||
|
||||
# We can't migrate if the home directory already exists
|
||||
if File.exists?(@_home_path)
|
||||
ui.warn I18n.t("vagrant.general.home_dir_migration_failed",
|
||||
|
|
|
@ -9,8 +9,15 @@ module Vagrant
|
|||
@env = env
|
||||
end
|
||||
|
||||
[:warn, :error, :info, :confirm, :say_with_vm, :report_progress, :ask, :no?, :yes?].each do |method|
|
||||
# By default these methods don't do anything. A silent UI.
|
||||
[:warn, :error, :info, :confirm].each do |method|
|
||||
define_method(method) do |message|
|
||||
# Log normal console messages
|
||||
env.logger.info(message)
|
||||
end
|
||||
end
|
||||
|
||||
[:report_progress, :ask, :no?, :yes?].each do |method|
|
||||
# By default do nothing, these aren't logged
|
||||
define_method(method) { |*args| }
|
||||
end
|
||||
|
||||
|
@ -26,6 +33,7 @@ module Vagrant
|
|||
[[:warn, :yellow], [:error, :red], [:info, nil], [:confirm, :green]].each do |method, color|
|
||||
class_eval <<-CODE
|
||||
def #{method}(message, opts=nil)
|
||||
super(message)
|
||||
@shell.say("\#{line_reset}\#{format_message(message, opts)}", #{color.inspect})
|
||||
end
|
||||
CODE
|
||||
|
@ -34,6 +42,7 @@ module Vagrant
|
|||
[:ask, :no?, :yes?].each do |method|
|
||||
class_eval <<-CODE
|
||||
def #{method}(message, opts=nil)
|
||||
super(message)
|
||||
opts ||= {}
|
||||
@shell.send(#{method.inspect}, format_message(message, opts), opts[:color])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue