Cmdline.cpp: optionally show debug output in --version output

SYNCEVOLUTION_DEBUG=1 syncevolution --daemon=no --version now
dumps also the debug information gathered by the binary
compatibility code. It was only available in sync logs before.
This commit is contained in:
Patrick Ohly 2016-09-20 07:58:39 -07:00
parent 5638b9ed3f
commit 2ad9a45d45
2 changed files with 7 additions and 6 deletions

View File

@ -731,11 +731,12 @@ bool Cmdline::run() {
if (m_usage) {
usage(true);
} else if (m_version) {
bool debug = atoi(getEnv("SYNCEVOLUTION_DEBUG", "0")) >= 1;
SE_LOG_SHOW(NULL, "SyncEvolution %s%s\n%s%s",
VERSION,
SyncContext::isStableRelease() ? "" : " (pre-release)",
EDSAbiWrapperInfo(),
SyncSource::backendsInfo().c_str());
debug ? EDSAbiWrapperDebug() : EDSAbiWrapperInfo(),
debug ? SyncSource::backendsDebug().c_str() : SyncSource::backendsInfo().c_str());
} else if (m_printServers || boost::trim_copy(m_server) == "?") {
dumpConfigs("Configured servers:",
SyncConfig::getConfigs());

View File

@ -403,7 +403,7 @@ public:
}
}
if (!replacement.empty()) {
debug << "Skipping " << basename << " = " << fullpath << " because a more recent version of it was already loaded: " << replacement;
debug << "Skipping " << basename << " = " << fullpath << " because a more recent version of it was already loaded: " << replacement << endl;
continue;
}
@ -416,11 +416,11 @@ public:
void *dlhandle = dlopen(fullpath.c_str(), RTLD_LAZY|RTLD_GLOBAL);
// remember which modules were found and which were not
if (dlhandle) {
debug<<"Loading backend library "<<basename<<endl;
info<<"Loading backend library "<<fullpath<<endl;
debug<<"Loaded backend library "<<basename<<endl;
info<<"Loaded backend library "<<fullpath<<endl;
m_available.push_back(basename);
} else {
debug<<"Loading backend library "<<basename<<"failed "<< dlerror()<<endl;
debug<<"Loading backend library "<<basename<<" failed: "<< dlerror()<<endl;
}
}
#endif