From 0d25c4ef8794b1488e8a4755449a08a239eb600e Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 21 Jun 2013 14:46:17 +0200 Subject: plugin-loader: Move logging of failed features to status() Still log an error message if critical features fail, as loaded plugins/features are not logged in that case. This way loaded plugins are printed before failed features and the relation is easier to make for users. It also allows programs to log this message on a different level. --- src/libstrongswan/plugins/plugin_loader.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/libstrongswan/plugins/plugin_loader.c') diff --git a/src/libstrongswan/plugins/plugin_loader.c b/src/libstrongswan/plugins/plugin_loader.c index 26310645b..e08b12306 100644 --- a/src/libstrongswan/plugins/plugin_loader.c +++ b/src/libstrongswan/plugins/plugin_loader.c @@ -968,14 +968,11 @@ METHOD(plugin_loader_t, load_plugins, bool, if (!critical_failed) { load_features(this); - /* evaluate stats collected while loading the features */ - critical_failed = this->stats.critical > 0; - if (this->stats.failed) + if (this->stats.critical > 0) { - DBG1(DBG_LIB, "failed to load %d plugin feature%s (%d due to unmet " - "dependencies, %d critical)", this->stats.failed, - this->stats.failed == 1 ? "" : "s", this->stats.depends, - this->stats.critical); + critical_failed = TRUE; + DBG1(DBG_LIB, "failed to load %d critical plugin feature%s", + this->stats.critical, this->stats.critical == 1 ? "" : "s"); } /* unload plugins that we were not able to load any features for */ purge_plugins(this); @@ -1088,6 +1085,13 @@ METHOD(plugin_loader_t, status, void, if (this->loaded_plugins) { dbg(DBG_LIB, level, "loaded plugins: %s", this->loaded_plugins); + + if (this->stats.failed) + { + dbg(DBG_LIB, level, "unable to load %d plugin feature%s (%d due to " + "unmet dependencies)", this->stats.failed, + this->stats.failed == 1 ? "" : "s", this->stats.depends); + } } } -- cgit v1.2.3