From 195a0d6999c5efaae5c41dc026651e9045779deb Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 25 Jan 2012 10:42:35 -0800 Subject: [PATCH] Logging for host detection --- lib/vagrant/hosts.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/hosts.rb b/lib/vagrant/hosts.rb index b58d7e303..2e7190816 100644 --- a/lib/vagrant/hosts.rb +++ b/lib/vagrant/hosts.rb @@ -1,3 +1,5 @@ +require 'log4r' + module Vagrant module Hosts autoload :Base, 'vagrant/hosts/base' @@ -11,13 +13,19 @@ module Vagrant # This method detects the correct host based on the `match?` methods # implemented in the registered hosts. def self.detect(registry) + logger = Log4r::Logger.new("vagrant::hosts") + # Sort the hosts by their precedence host_klasses = registry.to_hash.values host_klasses = host_klasses.sort_by { |a| a.precedence }.reverse + logger.debug("Host path search classes: #{host_klasses.inspect}") # Test for matches and return the host class that matches host_klasses.each do |klass| - return klass if klass.match? + if klass.match? + logger.info("Host class: #{klass}") + return klass + end end # No matches found...