add colour to stdout
fix cloud url update cloud api
This commit is contained in:
parent
701f1c8802
commit
80fcb5736f
@ -41,13 +41,16 @@ QString CloudAuthenticationHandler::nameSpace() const
|
|||||||
void CloudAuthenticationHandler::processAuthenticate(const QVariantMap ¶ms)
|
void CloudAuthenticationHandler::processAuthenticate(const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
if (params.contains("authenticationError")) {
|
if (params.contains("authenticationError")) {
|
||||||
if (params.value("authenticationError").toString() == "AuthenticationErrorSuccess") {
|
if (params.value("authenticationError").toString() == "AuthenticationErrorNoError") {
|
||||||
if (params.contains("connectionId"))
|
if (params.contains("connectionId")) {
|
||||||
GuhCore::instance()->cloudManager()->onConnectionAuthentificationFinished(true, params.value("connectionId").toUuid());
|
GuhCore::instance()->cloudManager()->onConnectionAuthentificationFinished(true, params.value("connectionId").toUuid());
|
||||||
} else {
|
return;
|
||||||
GuhCore::instance()->cloudManager()->onConnectionAuthentificationFinished(false, QUuid());
|
}
|
||||||
}
|
}
|
||||||
|
qCWarning(dcCloud()) << "Authentication error:" << params.value("authenticationError").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GuhCore::instance()->cloudManager()->onConnectionAuthentificationFinished(false, QUuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ void CloudInterface::dataReceived(const QVariantMap &data)
|
|||||||
|
|
||||||
// check if this is a reply to a request
|
// check if this is a reply to a request
|
||||||
if (!reply.isNull() && !data.contains("notification")) {
|
if (!reply.isNull() && !data.contains("notification")) {
|
||||||
qCDebug(dcCloud()) << "JsonRpc: got response for" << QString("%1.%2").arg(reply->nameSpace(), reply->method());
|
//qCDebug(dcCloud()) << "JsonRpc: got response for" << QString("%1.%2").arg(reply->nameSpace(), reply->method());
|
||||||
CloudJsonHandler *handler = m_handlers.value(reply->nameSpace());
|
CloudJsonHandler *handler = m_handlers.value(reply->nameSpace());
|
||||||
|
|
||||||
if (!QMetaObject::invokeMethod(handler, QString("process" + reply->method()).toLatin1().data(), Q_ARG(QVariantMap, params)))
|
if (!QMetaObject::invokeMethod(handler, QString("process" + reply->method()).toLatin1().data(), Q_ARG(QVariantMap, params)))
|
||||||
|
|||||||
@ -43,6 +43,10 @@
|
|||||||
|
|
||||||
static QHash<QString, bool> s_loggingFilters;
|
static QHash<QString, bool> s_loggingFilters;
|
||||||
|
|
||||||
|
static const char *const normal = "\033[0m";
|
||||||
|
static const char *const warning = "\e[33m";
|
||||||
|
static const char *const error = "\e[31m";
|
||||||
|
|
||||||
using namespace guhserver;
|
using namespace guhserver;
|
||||||
|
|
||||||
static void loggingCategoryFilter(QLoggingCategory *category)
|
static void loggingCategoryFilter(QLoggingCategory *category)
|
||||||
@ -74,15 +78,15 @@ static void consoleLogHandler(QtMsgType type, const QMessageLogContext& context,
|
|||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
messageString = QString(" W %1 | %2: %3").arg(timeString).arg(context.category).arg(message);
|
messageString = QString(" W %1 | %2: %3").arg(timeString).arg(context.category).arg(message);
|
||||||
fprintf(stdout, " W | %s: %s\n", context.category, message.toUtf8().data());
|
fprintf(stdout, "%s W | %s: %s%s\n", warning, context.category, message.toUtf8().data(), normal);
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
messageString = QString(" C %1 | %2: %3").arg(timeString).arg(context.category).arg(message);
|
messageString = QString(" C %1 | %2: %3").arg(timeString).arg(context.category).arg(message);
|
||||||
fprintf(stdout, " C | %s: %s\n", context.category, message.toUtf8().data());
|
fprintf(stdout, "%s C | %s: %s%s\n", error, context.category, message.toUtf8().data(), normal);
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
messageString = QString(" F %1 | %2: %3").arg(timeString).arg(context.category).arg(message);
|
messageString = QString(" F %1 | %2: %3").arg(timeString).arg(context.category).arg(message);
|
||||||
fprintf(stdout, " F | %s: %s\n", context.category, message.toUtf8().data());
|
fprintf(stdout, "%s F | %s: %s%s\n", error, context.category, message.toUtf8().data(), normal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -92,6 +96,7 @@ static void consoleLogHandler(QtMsgType type, const QMessageLogContext& context,
|
|||||||
fprintf(stdout, " W | Application: Could not open logfile.\n");
|
fprintf(stdout, " W | Application: Could not open logfile.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream textStream(&logFile);
|
QTextStream textStream(&logFile);
|
||||||
textStream << messageString << endl;
|
textStream << messageString << endl;
|
||||||
logFile.close();
|
logFile.close();
|
||||||
@ -164,17 +169,17 @@ int main(int argc, char *argv[])
|
|||||||
// create sorted loggingFiler list
|
// create sorted loggingFiler list
|
||||||
QStringList sortedFilterList = QStringList(s_loggingFilters.keys());
|
QStringList sortedFilterList = QStringList(s_loggingFilters.keys());
|
||||||
sortedFilterList.sort();
|
sortedFilterList.sort();
|
||||||
foreach (const QString &filterName, sortedFilterList) {
|
foreach (const QString &filterName, sortedFilterList)
|
||||||
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
||||||
}
|
|
||||||
|
|
||||||
// create sorted plugin loggingFiler list
|
// create sorted plugin loggingFiler list
|
||||||
QStringList sortedPluginList = QStringList(loggingFiltersPlugins.keys());
|
QStringList sortedPluginList = QStringList(loggingFiltersPlugins.keys());
|
||||||
sortedPluginList.sort();
|
sortedPluginList.sort();
|
||||||
debugDescription += "\n\nPlugin categories:\n";
|
debugDescription += "\n\nPlugin categories:\n";
|
||||||
foreach (const QString &filterName, sortedPluginList) {
|
foreach (const QString &filterName, sortedPluginList)
|
||||||
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
||||||
}
|
|
||||||
|
|
||||||
QCommandLineOption allOption(QStringList() << "p" << "print-all", QCoreApplication::translate("main", "Enables all debug categories. This parameter overrides all debug category parameters."));
|
QCommandLineOption allOption(QStringList() << "p" << "print-all", QCoreApplication::translate("main", "Enables all debug categories. This parameter overrides all debug category parameters."));
|
||||||
parser.addOption(allOption);
|
parser.addOption(allOption);
|
||||||
@ -184,9 +189,8 @@ int main(int argc, char *argv[])
|
|||||||
parser.process(application);
|
parser.process(application);
|
||||||
|
|
||||||
// add plugin metadata to the static hash
|
// add plugin metadata to the static hash
|
||||||
foreach (const QString &category, loggingFiltersPlugins.keys()) {
|
foreach (const QString &category, loggingFiltersPlugins.keys())
|
||||||
s_loggingFilters.insert(category, false);
|
s_loggingFilters.insert(category, false);
|
||||||
}
|
|
||||||
|
|
||||||
// check debug area
|
// check debug area
|
||||||
if (!parser.isSet(allOption)) {
|
if (!parser.isSet(allOption)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user