From 91ae6178df762ba55daf2246d060c9e737d0d018 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 20 May 2010 16:46:23 -0700 Subject: [PATCH] Runner loggers now use their @runner.logger instead of "global" logger --- lib/vagrant/actions/base.rb | 8 ++++++++ lib/vagrant/box.rb | 4 ++-- test/test_helper.rb | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/actions/base.rb b/lib/vagrant/actions/base.rb index c8a381a9c..922a89008 100644 --- a/lib/vagrant/actions/base.rb +++ b/lib/vagrant/actions/base.rb @@ -29,6 +29,14 @@ module Vagrant # Included so subclasses don't need to include it themselves. include Vagrant::Util + # A helper method for logging which simply gets the logger from + # the runner. Since actions tend to log quite a bit, this + # removes the need to prefix `logger` with `@runner` over and + # over. + def logger + runner.logger + end + # Initialization of the action, passing any arguments which may have # been given to the {Runner runner}. This method can be used by subclasses # to save any of the configuration options which are passed in. diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index c599e626c..723fa2c74 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -56,7 +56,7 @@ module Vagrant # of a specific instance. attr_accessor :env - class <] @@ -149,4 +149,4 @@ module Vagrant self.class.directory(env, self.name) end end -end \ No newline at end of file +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 420a180f2..42b746251 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -105,6 +105,7 @@ class Test::Unit::TestCase mock_vm.stubs(:invoke_around_callback).yields mock_vm.stubs(:actions).returns([action]) mock_vm.stubs(:env).returns(mock_environment) + mock_vm.stubs(:logger).returns(Vagrant::ResourceLogger.new("mock", nil)) mock_ssh = Vagrant::SSH.new(mock_vm.env) mock_ssh.stubs(:execute)