mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-04 04:23:55 -07:00
add logging category for remote_client (#5553)
* add logging category for remote_client * remove ifdef QT_DEBUG
This commit is contained in:
parent
94e2d64e55
commit
c00b41f3bd
3 changed files with 17 additions and 13 deletions
|
|
@ -23,6 +23,8 @@
|
||||||
# servers_settings = false
|
# servers_settings = false
|
||||||
# shortcuts_settings = false
|
# shortcuts_settings = false
|
||||||
|
|
||||||
|
# remote_client = false
|
||||||
|
|
||||||
# player = false
|
# player = false
|
||||||
# game_scene = false
|
# game_scene = false
|
||||||
# game_scene.player_addition_removal = false
|
# game_scene.player_addition_removal = false
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
|
||||||
hashedPassword = PasswordHasher::computeHash(password, passwordSalt);
|
hashedPassword = PasswordHasher::computeHash(password, passwordSalt);
|
||||||
cmdForgotPasswordReset.set_hashed_new_password(hashedPassword.toStdString());
|
cmdForgotPasswordReset.set_hashed_new_password(hashedPassword.toStdString());
|
||||||
} else if (!password.isEmpty()) {
|
} else if (!password.isEmpty()) {
|
||||||
qWarning() << "using plain text password to reset password";
|
qCWarning(RemoteClientLog) << "using plain text password to reset password";
|
||||||
cmdForgotPasswordReset.set_new_password(password.toStdString());
|
cmdForgotPasswordReset.set_new_password(password.toStdString());
|
||||||
}
|
}
|
||||||
PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordReset);
|
PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordReset);
|
||||||
|
|
@ -170,7 +170,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
|
||||||
hashedPassword = PasswordHasher::computeHash(password, passwordSalt);
|
hashedPassword = PasswordHasher::computeHash(password, passwordSalt);
|
||||||
cmdRegister.set_hashed_password(hashedPassword.toStdString());
|
cmdRegister.set_hashed_password(hashedPassword.toStdString());
|
||||||
} else if (!password.isEmpty()) {
|
} else if (!password.isEmpty()) {
|
||||||
qWarning() << "using plain text password to register";
|
qCWarning(RemoteClientLog) << "using plain text password to register";
|
||||||
cmdRegister.set_password(password.toStdString());
|
cmdRegister.set_password(password.toStdString());
|
||||||
}
|
}
|
||||||
cmdRegister.set_email(email.toStdString());
|
cmdRegister.set_email(email.toStdString());
|
||||||
|
|
@ -241,7 +241,7 @@ void RemoteClient::doLogin()
|
||||||
setStatus(StatusLoggingIn);
|
setStatus(StatusLoggingIn);
|
||||||
Command_Login cmdLogin = generateCommandLogin();
|
Command_Login cmdLogin = generateCommandLogin();
|
||||||
if (!password.isEmpty()) {
|
if (!password.isEmpty()) {
|
||||||
qWarning() << "using plain text password to log in";
|
qCWarning(RemoteClientLog) << "using plain text password to log in";
|
||||||
cmdLogin.set_password(password.toStdString());
|
cmdLogin.set_password(password.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,9 +393,9 @@ void RemoteClient::readData()
|
||||||
|
|
||||||
ServerMessage newServerMessage;
|
ServerMessage newServerMessage;
|
||||||
newServerMessage.ParseFromArray(inputBuffer.data(), messageLength);
|
newServerMessage.ParseFromArray(inputBuffer.data(), messageLength);
|
||||||
#ifdef QT_DEBUG
|
|
||||||
qDebug().noquote() << "IN" << getSafeDebugString(newServerMessage);
|
qCDebug(RemoteClientLog).noquote() << "IN" << getSafeDebugString(newServerMessage);
|
||||||
#endif
|
|
||||||
inputBuffer.remove(0, messageLength);
|
inputBuffer.remove(0, messageLength);
|
||||||
messageInProgress = false;
|
messageInProgress = false;
|
||||||
|
|
||||||
|
|
@ -411,9 +411,9 @@ void RemoteClient::websocketMessageReceived(const QByteArray &message)
|
||||||
lastDataReceived = timeRunning;
|
lastDataReceived = timeRunning;
|
||||||
ServerMessage newServerMessage;
|
ServerMessage newServerMessage;
|
||||||
newServerMessage.ParseFromArray(message.data(), message.length());
|
newServerMessage.ParseFromArray(message.data(), message.length());
|
||||||
#ifdef QT_DEBUG
|
|
||||||
qDebug().noquote() << "IN" << getSafeDebugString(newServerMessage);
|
qCDebug(RemoteClientLog).noquote() << "IN" << getSafeDebugString(newServerMessage);
|
||||||
#endif
|
|
||||||
processProtocolItem(newServerMessage);
|
processProtocolItem(newServerMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -424,9 +424,8 @@ void RemoteClient::sendCommandContainer(const CommandContainer &cont)
|
||||||
#else
|
#else
|
||||||
auto size = static_cast<unsigned int>(cont.ByteSize());
|
auto size = static_cast<unsigned int>(cont.ByteSize());
|
||||||
#endif
|
#endif
|
||||||
#ifdef QT_DEBUG
|
|
||||||
qDebug().noquote() << "OUT" << getSafeDebugString(cont);
|
qCDebug(RemoteClientLog).noquote() << "OUT" << getSafeDebugString(cont);
|
||||||
#endif
|
|
||||||
|
|
||||||
QByteArray buf;
|
QByteArray buf;
|
||||||
if (usingWebSocket) {
|
if (usingWebSocket) {
|
||||||
|
|
@ -590,7 +589,7 @@ QString RemoteClient::getSrvClientID(const QString &_hostname)
|
||||||
QHostAddress hostAddress = hostInfo.addresses().first();
|
QHostAddress hostAddress = hostInfo.addresses().first();
|
||||||
srvClientID += hostAddress.toString();
|
srvClientID += hostAddress.toString();
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "ClientID generation host lookup failure [" << hostInfo.errorString() << "]";
|
qCWarning(RemoteClientLog) << "ClientID generation host lookup failure [" << hostInfo.errorString() << "]";
|
||||||
srvClientID += _hostname;
|
srvClientID += _hostname;
|
||||||
}
|
}
|
||||||
QString uniqueServerClientID =
|
QString uniqueServerClientID =
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,12 @@
|
||||||
#include "../../client/game_logic/abstract_client.h"
|
#include "../../client/game_logic/abstract_client.h"
|
||||||
#include "pb/commands.pb.h"
|
#include "pb/commands.pb.h"
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QWebSocket>
|
#include <QWebSocket>
|
||||||
|
|
||||||
|
inline Q_LOGGING_CATEGORY(RemoteClientLog, "remote_client");
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
class RemoteClient : public AbstractClient
|
class RemoteClient : public AbstractClient
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue