Only initialize a logger on the parent environment
This commit is contained in:
parent
32aa5ef4d1
commit
d65194d66e
|
@ -158,6 +158,7 @@ module Vagrant
|
|||
# logger which should be used to log internals only. For outward
|
||||
# facing information, use {#ui}.
|
||||
def logger
|
||||
return parent.logger if parent
|
||||
@logger ||= Util::ResourceLogger.new(resource, self)
|
||||
end
|
||||
|
||||
|
|
|
@ -254,6 +254,15 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
assert_equal result, @env.logger
|
||||
assert_equal result, @env.logger
|
||||
end
|
||||
|
||||
should "return the parent's local data if a parent exists" do
|
||||
@env = mock_environment
|
||||
@env.stubs(:parent).returns(mock_environment)
|
||||
result = @env.parent.logger
|
||||
|
||||
Vagrant::Util::ResourceLogger.expects(:new).never
|
||||
assert_equal result, @env.logger
|
||||
end
|
||||
end
|
||||
|
||||
context "loading" do
|
||||
|
|
Loading…
Reference in New Issue