Enable verbose and debug logging in command line options.

This commit is contained in:
codestation
2013-08-30 13:46:24 -04:30
parent fb0845e8a1
commit bc9e84ad13

View File

@@ -49,13 +49,6 @@ int main(int argc, char *argv[])
SingleApplication app(argc, argv); SingleApplication app(argc, argv);
QTranslator translator;
QString locale = QLocale().system().name();
qDebug() << "Current locale:" << locale;
if(translator.load("qcma." + locale, ":/main/resources/translations")) {
app.installTranslator(&translator);
}
#ifndef Q_OS_WIN32 #ifndef Q_OS_WIN32
// FIXME: libmtp sends SIGPIPE if a socket write fails crashing the whole app // FIXME: libmtp sends SIGPIPE if a socket write fails crashing the whole app
// the proper fix is to libmtp to handle the cancel properly or ignoring // the proper fix is to libmtp to handle the cancel properly or ignoring
@@ -63,15 +56,24 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif #endif
if(!app.arguments().contains("--with-debug")) { if(app.arguments().contains("--with-debug")) {
VitaMTP_Set_Logging(VitaMTP_DEBUG);
} else if(app.arguments().contains("--verbose")) {
VitaMTP_Set_Logging(VitaMTP_VERBOSE);
} else {
VitaMTP_Set_Logging(VitaMTP_NONE); VitaMTP_Set_Logging(VitaMTP_NONE);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler(noMessageOutput); qInstallMessageHandler(noMessageOutput);
#else #else
qInstallMsgHandler(noMessageOutput); qInstallMsgHandler(noMessageOutput);
#endif #endif
} else { }
VitaMTP_Set_Logging(VitaMTP_VERBOSE);
QTranslator translator;
QString locale = QLocale().system().name();
qDebug() << "Current locale:" << locale;
if(translator.load("qcma." + locale, ":/main/resources/translations")) {
app.installTranslator(&translator);
} }
qDebug() << "From main thread: "<< QThread::currentThreadId(); qDebug() << "From main thread: "<< QThread::currentThreadId();