YUKI Hiroshi
null+****@clear*****
Thu Feb 13 15:52:39 JST 2014
YUKI Hiroshi 2014-02-13 15:52:39 +0900 (Thu, 13 Feb 2014) New Revision: 7120d1f9edcbab1f0e966bf1c0533053f4d237da https://github.com/droonga/fluent-plugin-droonga/commit/7120d1f9edcbab1f0e966bf1c0533053f4d237da Message: Report list of loaded plugins in a time Modified files: lib/droonga/plugin_loader.rb Modified: lib/droonga/plugin_loader.rb (+13 -2) =================================================================== --- lib/droonga/plugin_loader.rb 2014-02-13 15:19:24 +0900 (e822bbf) +++ lib/droonga/plugin_loader.rb 2014-02-13 15:52:39 +0900 (48a5c58) @@ -21,26 +21,37 @@ module Droonga class PluginLoader class << self def load_all + loaded = [] + loading = nil + begin $LOAD_PATH.each do |load_path| Dir.glob("#{load_path}/droonga/plugin/*") do |type_path| next unless File.directory?(type_path) type = File.basename(type_path) Dir.glob("#{type_path}/*.rb") do |path| - $log.info("#{self.name}: loading: #{path}") + loading = path name = File.basename(path, ".rb") loader = new(type, name) loader.load + loaded << path end end Pathname.glob("#{load_path}/droonga/plugins/*.rb") do |plugin_path| - $log.info("#{self.name}: loading: #{plugin_path}") + loading = plugin_path relative_plugin_path = plugin_path.relative_path_from(Pathname(load_path)) require_path = relative_plugin_path.to_s.gsub(/\.rb\z/, "") require require_path + loaded << plugin_path end end + rescue StandardError, SyntaxError => error + $log.info("#{self.name}: loaded plugins:\n#{loaded.join("\n")}") + $log.error("#{self.name}: failed to load: #{loading}") + raise error + end + $log.info("#{self.name}: loaded plugins:\n#{loaded.join("\n")}") end end -------------- next part -------------- HTML����������������������������...Download