Allow enabling of logging with VAGRANT_LOG

This commit is contained in:
Mitchell Hashimoto 2011-12-03 16:11:31 -08:00
parent 1355487a04
commit 271d1a92f0
1 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,15 @@ require 'log4r'
require 'vagrant'
require 'vagrant/cli'
# Enable logging if it is requested. We do this before
# anything else so that all logs are visible.
if ENV["VAGRANT_LOG"]
logger = Log4r::Logger.new("vagrant")
logger.outputters = Log4r::Outputter.stdout
logger.level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase)
logger = nil
end
# Create a logger right away
logger = Log4r::Logger.new("vagrant::bin::vagrant")
logger.info("`vagrant` invoked: #{ARGV.inspect}")