Refine the loglevel

This commit is contained in:
Kevin Yue 2020-02-20 22:25:10 +08:00
parent c68338c180
commit 439d6f7db7
3 changed files with 5 additions and 13 deletions

View File

@ -74,14 +74,12 @@ void GPClient::on_connectButton_clicked()
void GPClient::preloginResultFinished() void GPClient::preloginResultFinished()
{ {
if (reply->error()) { if (reply->error()) {
qDebug() << "Prelogin request error"; qWarning() << "Prelogin request error";
emit connectFailed(); emit connectFailed();
return; return;
} }
QByteArray bytes = reply->readAll(); QByteArray bytes = reply->readAll();
qDebug("response is: %s", bytes.toStdString().c_str());
const QString tagMethod = "saml-auth-method"; const QString tagMethod = "saml-auth-method";
const QString tagRequest = "saml-request"; const QString tagRequest = "saml-request";
QString samlMethod; QString samlMethod;
@ -100,7 +98,7 @@ void GPClient::preloginResultFinished()
} }
if (samlMethod == nullptr || samlRequest == nullptr) { if (samlMethod == nullptr || samlRequest == nullptr) {
qDebug("This does not appear to be a SAML prelogin response (<saml-auth-method> or <saml-request> tags missing)"); qWarning("This does not appear to be a SAML prelogin response (<saml-auth-method> or <saml-request> tags missing)");
emit connectFailed(); emit connectFailed();
return; return;
} }
@ -110,15 +108,12 @@ void GPClient::preloginResultFinished()
qDebug("TODO: SAML method is POST"); qDebug("TODO: SAML method is POST");
emit connectFailed(); emit connectFailed();
} else if (samlMethod == "REDIRECT") { } else if (samlMethod == "REDIRECT") {
qInfo() << "Request URL is: %s" << samlRequest;
samlLogin(samlRequest); samlLogin(samlRequest);
} }
} }
void GPClient::onLoginSuccess(QJsonObject loginResult) void GPClient::onLoginSuccess(QJsonObject loginResult)
{ {
qDebug() << "Login success:" << loginResult;
QString fullpath = "/ssl-vpn/login.esp"; QString fullpath = "/ssl-vpn/login.esp";
QString shortpath = "gateway"; QString shortpath = "gateway";
QString user = loginResult.value("saml-username").toString(); QString user = loginResult.value("saml-username").toString();
@ -166,18 +161,16 @@ void GPClient::onVPNConnected()
void GPClient::onVPNDisconnected() void GPClient::onVPNDisconnected()
{ {
qDebug("========= disconnected");
updateConnectionStatus("not_connected"); updateConnectionStatus("not_connected");
} }
void GPClient::onVPNLogAvailable(QString log) void GPClient::onVPNLogAvailable(QString log)
{ {
qDebug() << log; qInfo() << log;
} }
void GPClient::initVpnStatus() { void GPClient::initVpnStatus() {
int status = vpn->status(); int status = vpn->status();
qDebug() << "VPN status:" << status;
if (status == 1) { if (status == 1) {
ui->statusLabel->setText("Connecting..."); ui->statusLabel->setText("Connecting...");
updateConnectionStatus("pending"); updateConnectionStatus("pending");
@ -214,8 +207,6 @@ void GPClient::moveCenter()
void GPClient::doAuth(const QString portal) void GPClient::doAuth(const QString portal)
{ {
const QString preloginUrl = "https://" + portal + "/ssl-vpn/prelogin.esp"; const QString preloginUrl = "https://" + portal + "/ssl-vpn/prelogin.esp";
qDebug("%s", preloginUrl.toStdString().c_str());
reply = networkManager->post(QNetworkRequest(preloginUrl), (QByteArray) nullptr); reply = networkManager->post(QNetworkRequest(preloginUrl), (QByteArray) nullptr);
connect(reply, &QNetworkReply::finished, this, &GPClient::preloginResultFinished); connect(reply, &QNetworkReply::finished, this, &GPClient::preloginResultFinished);
} }

View File

@ -1,5 +1,6 @@
#include "singleapplication.h" #include "singleapplication.h"
#include "gpclient.h" #include "gpclient.h"
#include "enhancedwebview.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View File

@ -130,6 +130,6 @@ void GPService::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
void GPService::log(QString msg) void GPService::log(QString msg)
{ {
qDebug() << msg; qInfo() << msg;
emit logAvailable(msg); emit logAvailable(msg);
} }