From e5903129e1abe0979a2a5a80a38c2800060b8e90 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 10 Feb 2010 22:12:34 -0800 Subject: [PATCH] Logger now uses singleton on the Vagrant::Logger class. Tests included. --- lib/vagrant/util.rb | 24 +++++++++++++++------ test/vagrant/util_test.rb | 45 +++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/lib/vagrant/util.rb b/lib/vagrant/util.rb index c36197d8b..a29642c3b 100644 --- a/lib/vagrant/util.rb +++ b/lib/vagrant/util.rb @@ -12,16 +12,28 @@ error end def logger - # TODO: Buffer messages until config is loaded, then output them? - if Vagrant.config.loaded? - @logger ||= Vagrant::Logger.new(Vagrant.config.vagrant.log_output) - else - Vagrant::Logger.new(nil) - end + Logger.singleton_logger end end class Logger < ::Logger + @@singleton_logger = nil + + class <