Merge pull request #2713 from tmatilai/log_plugin_versions
core: log loaded plugin versions
This commit is contained in:
commit
5146bc2696
|
@ -186,8 +186,9 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @param [String] name Name of the plugin to load.
|
# @param [String] name Name of the plugin to load.
|
||||||
def self.require_plugin(name)
|
def self.require_plugin(name)
|
||||||
|
logger = Log4r::Logger.new("vagrant::root")
|
||||||
|
|
||||||
if ENV["VAGRANT_NO_PLUGINS"]
|
if ENV["VAGRANT_NO_PLUGINS"]
|
||||||
logger = Log4r::Logger.new("vagrant::root")
|
|
||||||
logger.warn("VAGRANT_NO_PLUGINS is set, not loading 3rd party plugin: #{name}")
|
logger.warn("VAGRANT_NO_PLUGINS is set, not loading 3rd party plugin: #{name}")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -205,7 +206,6 @@ module Vagrant
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
# Since this is a rare case, we create a one-time logger here
|
# Since this is a rare case, we create a one-time logger here
|
||||||
# in order to output the error
|
# in order to output the error
|
||||||
logger = Log4r::Logger.new("vagrant::root")
|
|
||||||
logger.error("Failed to load plugin: #{name}")
|
logger.error("Failed to load plugin: #{name}")
|
||||||
logger.error(" -- Error: #{e.inspect}")
|
logger.error(" -- Error: #{e.inspect}")
|
||||||
logger.error(" -- Backtrace:")
|
logger.error(" -- Backtrace:")
|
||||||
|
@ -236,6 +236,12 @@ module Vagrant
|
||||||
raise Errors::PluginLoadFailed,
|
raise Errors::PluginLoadFailed,
|
||||||
:plugin => name
|
:plugin => name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Log plugin version
|
||||||
|
gem = Gem::Specification.find { |spec| spec.name == name }
|
||||||
|
version = gem ? gem.version : "<unknown>"
|
||||||
|
logger.info("Loaded plugin #{name}, version #{version}")
|
||||||
|
|
||||||
ensure
|
ensure
|
||||||
$stderr = previous_stderr if previous_stderr
|
$stderr = previous_stderr if previous_stderr
|
||||||
$stdout = previous_stdout if previous_stdout
|
$stdout = previous_stdout if previous_stdout
|
||||||
|
|
Loading…
Reference in New Issue