From 1f45c5a788d5119ef2d157ea0da8e98e49b162ba Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Wed, 29 Jul 2015 17:23:16 +0100 Subject: [PATCH] Ensure correct order of logger creation Loggers must be defined in the correct heirarchial order to ensure that child loggers inherit the level defined on the parent logger. Otherwise need to traverse the entire tree to modify the level. --- lib/vagrant-libvirt.rb | 4 +++- lib/vagrant-libvirt/plugin.rb | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/vagrant-libvirt.rb b/lib/vagrant-libvirt.rb index 825e5fa..24322c0 100644 --- a/lib/vagrant-libvirt.rb +++ b/lib/vagrant-libvirt.rb @@ -1,5 +1,4 @@ require 'pathname' -require 'vagrant-libvirt/plugin' module VagrantPlugins module ProviderLibvirt @@ -27,3 +26,6 @@ module VagrantPlugins end end end + +# make sure base module class defined before loading plugin +require 'vagrant-libvirt/plugin' diff --git a/lib/vagrant-libvirt/plugin.rb b/lib/vagrant-libvirt/plugin.rb index 1dbb56c..0b7cae3 100644 --- a/lib/vagrant-libvirt/plugin.rb +++ b/lib/vagrant-libvirt/plugin.rb @@ -24,10 +24,6 @@ module VagrantPlugins end provider('libvirt', parallel: true) do - # Setup logging and i18n - setup_logging - setup_i18n - require_relative 'provider' Provider end @@ -90,6 +86,12 @@ module VagrantPlugins end end + # Setup logging and i18n before any autoloading loads other classes + # with logging configured as this prevents inheritance of the log level + # from the parent logger. + setup_logging + setup_i18n + end end end