1
0
mirror of synced 2025-01-19 01:24:15 +01:00

impr: Improve plugin unload logging

This commit is contained in:
WerWolv 2024-01-09 10:54:53 +01:00
parent 301e95b708
commit 037d77f28e
2 changed files with 7 additions and 2 deletions

View File

@ -27,7 +27,7 @@
#define IMHEX_LIBRARY_SETUP(name) IMHEX_LIBRARY_SETUP_IMPL(name)
#define IMHEX_LIBRARY_SETUP_IMPL(name) \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloading library '{}'", name); } } HANDLER; } \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloaded library '{}'", name); } } HANDLER; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary(); \
static auto WOLV_TOKEN_CONCAT(libraryInitializer_, IMHEX_PLUGIN_NAME) = [] { \
initializeLibrary(); \
@ -54,7 +54,7 @@
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary()
#define IMHEX_PLUGIN_SETUP_IMPL(name, author, description) \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloading plugin '{}'", name); } } HANDLER; } \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloaded plugin '{}'", name); } } HANDLER; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginName() { return name; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginAuthor() { return author; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginDescription() { return description; } \

View File

@ -260,6 +260,11 @@ namespace hex {
auto &plugins = getPlugins();
const auto pluginCount = plugins.size();
for (size_t i = 0; i < pluginCount; i++) {
auto &plugin = plugins[pluginCount - 1 - i];
if (plugin.isLoaded()) {
log::info("Trying to unload plugin '{}'", plugin.getPluginName());
}
plugins.pop_back();
}
}