Mercurial > hg > svcore
comparison plugin/PluginScan.cpp @ 1247:8f076d02569a piper
Make SVDEBUG always write to a log file -- formerly this was disabled in NDEBUG builds. I think there's little use to that, it just means that we keep adding more cerr debug output because we aren't getting the log we need. And SVDEBUG logging is not usually used in tight loops, I don't think the performance overhead is too serious.
Also update the About box.
author | Chris Cannam |
---|---|
date | Thu, 03 Nov 2016 14:57:00 +0000 |
parents | 75aefcc9f07d |
children | d45a16c232bd |
comparison
equal
deleted
inserted
replaced
1246:75aefcc9f07d | 1247:8f076d02569a |
---|---|
23 #include <QMutex> | 23 #include <QMutex> |
24 #include <QCoreApplication> | 24 #include <QCoreApplication> |
25 | 25 |
26 using std::string; | 26 using std::string; |
27 | 27 |
28 //#define DEBUG_PLUGIN_SCAN 1 | |
29 | |
30 class PluginScan::Logger : public PluginCandidates::LogCallback | 28 class PluginScan::Logger : public PluginCandidates::LogCallback |
31 { | 29 { |
32 protected: | 30 protected: |
33 void log(std::string message) { | 31 void log(std::string message) { |
34 #ifdef DEBUG_PLUGIN_SCAN | |
35 cerr << "PluginScan: " << message; | |
36 #endif | |
37 SVDEBUG << "PluginScan: " << message; | 32 SVDEBUG << "PluginScan: " << message; |
38 } | 33 } |
39 }; | 34 }; |
40 | 35 |
41 PluginScan *PluginScan::getInstance() | 36 PluginScan *PluginScan::getInstance() |
72 auto helpers = hep.getHelperExecutables(helperName); | 67 auto helpers = hep.getHelperExecutables(helperName); |
73 | 68 |
74 clear(); | 69 clear(); |
75 | 70 |
76 for (auto p: helpers) { | 71 for (auto p: helpers) { |
77 cerr << "NOTE: PluginScan: Found helper: " << p.executable << endl; | 72 SVDEBUG << "NOTE: PluginScan: Found helper: " << p.executable << endl; |
78 } | 73 } |
79 | 74 |
80 if (helpers.empty()) { | 75 if (helpers.empty()) { |
81 cerr << "NOTE: No plugin checker helpers found in installation;" | 76 SVDEBUG << "NOTE: No plugin checker helpers found in installation;" |
82 << " found none of the following:" << endl; | 77 << " found none of the following:" << endl; |
83 for (auto d: hep.getHelperCandidatePaths(helperName)) { | 78 for (auto d: hep.getHelperCandidatePaths(helperName)) { |
84 cerr << "NOTE: " << d << endl; | 79 SVDEBUG << "NOTE: " << d << endl; |
85 } | 80 } |
86 } | 81 } |
87 | 82 |
88 for (auto p: helpers) { | 83 for (auto p: helpers) { |
89 try { | 84 try { |
90 KnownPlugins *kp = new KnownPlugins | 85 KnownPlugins *kp = new KnownPlugins |
91 (p.executable.toStdString(), m_logger); | 86 (p.executable.toStdString(), m_logger); |
92 if (m_kp.find(p.tag) != m_kp.end()) { | 87 if (m_kp.find(p.tag) != m_kp.end()) { |
93 cerr << "WARNING: PluginScan::scan: Duplicate tag " << p.tag | 88 SVDEBUG << "WARNING: PluginScan::scan: Duplicate tag " << p.tag |
94 << " for helpers" << endl; | 89 << " for helpers" << endl; |
95 continue; | 90 continue; |
96 } | 91 } |
97 m_kp[p.tag] = kp; | 92 m_kp[p.tag] = kp; |
98 m_succeeded = true; | 93 m_succeeded = true; |
99 } catch (const std::exception &e) { | 94 } catch (const std::exception &e) { |
100 cerr << "ERROR: PluginScan::scan: " << e.what() | 95 SVDEBUG << "ERROR: PluginScan::scan: " << e.what() |
101 << " (with helper path = " << p.executable << ")" << endl; | 96 << " (with helper path = " << p.executable << ")" << endl; |
102 } | 97 } |
103 } | 98 } |
104 } | 99 } |
105 | 100 |
139 | 134 |
140 KnownPlugins *kp = rec.second; | 135 KnownPlugins *kp = rec.second; |
141 | 136 |
142 auto c = kp->getCandidateLibrariesFor(kpt); | 137 auto c = kp->getCandidateLibrariesFor(kpt); |
143 | 138 |
144 std::cerr << "PluginScan: helper \"" << kp->getHelperExecutableName() | 139 SVDEBUG << "PluginScan: helper \"" << kp->getHelperExecutableName() |
145 << "\" likes " << c.size() << " libraries of type " | 140 << "\" likes " << c.size() << " libraries of type " |
146 << kp->getTagFor(kpt) << std::endl; | 141 << kp->getTagFor(kpt) << endl; |
147 | 142 |
148 for (auto s: c) { | 143 for (auto s: c) { |
149 candidates.push_back({ s.c_str(), rec.first }); | 144 candidates.push_back({ s.c_str(), rec.first }); |
150 } | 145 } |
151 | 146 |