Improve logging of issues during plugin loading
authorHannah von Reth <hannah.vonreth@owncloud.com>
Wed, 18 Mar 2020 11:26:15 +0000 (12:26 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:08 +0000 (10:59 +0100)
If the plugin could not be loaded the client calls qFatal
Make the loading warnings critical so they get printed before we crash

src/common/vfs.cpp

index 69c3771704a8b363a9fe4c398083146a5d9e1c6e..45a00ef8b2d3cd714fb27be638d51bdf6e15c04d 100644 (file)
@@ -185,26 +185,26 @@ std::unique_ptr<Vfs> OCC::createVfsFromPlugin(Vfs::Mode mode)
     auto pluginPath = pluginFileName("vfs", name);
 
     if (!isVfsPluginAvailable(mode)) {
-        qCWarning(lcPlugin) << "Could not load plugin: not existant or bad metadata" << pluginPath;
+        qCCritical(lcPlugin) << "Could not load plugin: not existant or bad metadata" << pluginPath;
         return nullptr;
     }
 
     QPluginLoader loader(pluginPath);
     auto plugin = loader.instance();
     if (!plugin) {
-        qCWarning(lcPlugin) << "Could not load plugin" << pluginPath << loader.errorString();
+        qCCritical(lcPlugin) << "Could not load plugin" << pluginPath << loader.errorString();
         return nullptr;
     }
 
     auto factory = qobject_cast<PluginFactory *>(plugin);
     if (!factory) {
-        qCWarning(lcPlugin) << "Plugin" << pluginPath << "does not implement PluginFactory";
+        qCCritical(lcPlugin) << "Plugin" << loader.fileName() << "does not implement PluginFactory";
         return nullptr;
     }
 
     auto vfs = std::unique_ptr<Vfs>(qobject_cast<Vfs *>(factory->create(nullptr)));
     if (!vfs) {
-        qCWarning(lcPlugin) << "Plugin" << pluginPath << "does not create a Vfs instance";
+        qCCritical(lcPlugin) << "Plugin" << loader.fileName() << "does not create a Vfs instance";
         return nullptr;
     }