Added extra logging to plugin loaders #4168

This commit is contained in:
Nick Bolton 2015-02-26 00:03:24 +00:00
parent 64c350fd96
commit bcf1a1c4d4
2 changed files with 6 additions and 2 deletions

View File

@ -64,7 +64,6 @@ ArchPluginUnix::load()
while ((de = readdir(dir)) != NULL) { while ((de = readdir(dir)) != NULL) {
// ignore hidden files and diretories like .. and . // ignore hidden files and diretories like .. and .
if (de->d_name[0] != '.') { if (de->d_name[0] != '.') {
LOG((CLOG_DEBUG "load plugin %s", de->d_name));
plugins.push_back(de->d_name); plugins.push_back(de->d_name);
} }
} }
@ -77,11 +76,13 @@ ArchPluginUnix::load()
void* library = dlopen(path.c_str(), RTLD_LAZY); void* library = dlopen(path.c_str(), RTLD_LAZY);
if (library == NULL) { if (library == NULL) {
LOG((CLOG_ERR "failed to load plugin: %s", (*it).c_str()));
throw XArch(dlerror()); throw XArch(dlerror());
} }
String filename = synergy::string::removeFileExt(*it); String filename = synergy::string::removeFileExt(*it);
m_pluginTable.insert(std::make_pair(filename, library)); m_pluginTable.insert(std::make_pair(filename, library));
LOG((CLOG_ERR "loaded plugin: %s", (*it).c_str()));
} }
} }

View File

@ -56,16 +56,19 @@ ArchPluginWindows::load()
std::vector<String>::iterator it; std::vector<String>::iterator it;
for (it = plugins.begin(); it != plugins.end(); ++it) { for (it = plugins.begin(); it != plugins.end(); ++it) {
LOG((CLOG_DEBUG "loading plugin: %s", (*it).c_str())); LOG((CLOG_DEBUG "loading plugin: %s", (*it).c_str()));
String path = String(getPluginsDir()).append("\\").append(*it); String path = String(dir).append("\\").append(*it);
HINSTANCE library = LoadLibrary(path.c_str()); HINSTANCE library = LoadLibrary(path.c_str());
if (library == NULL) { if (library == NULL) {
LOG((CLOG_ERR "failed to load plugin: %s %d", (*it).c_str(), GetLastError()));
throw XArch(new XArchEvalWindows); throw XArch(new XArchEvalWindows);
} }
void* lib = reinterpret_cast<void*>(library); void* lib = reinterpret_cast<void*>(library);
String filename = synergy::string::removeFileExt(*it); String filename = synergy::string::removeFileExt(*it);
m_pluginTable.insert(std::make_pair(filename, lib)); m_pluginTable.insert(std::make_pair(filename, lib));
LOG((CLOG_ERR "loaded plugin: %s", (*it).c_str()));
} }
} }