Reconsider approach to transport log information

This commit is contained in:
Salanto 2021-08-24 16:01:36 +02:00
parent 5af2be130d
commit f8fd854f3f
4 changed files with 21 additions and 135 deletions

View File

@ -66,7 +66,6 @@ HEADERS += include/advertiser.h \
include/ws_proxy.h \
include/http_advertiser.h \
include/logger/u_logger.h \
include/logger/u_logger_datatypes.h \
include/logger/writer_modcall.h \
include/logger/writer_full.h \
include/logger/writer_sql.h

View File

@ -22,7 +22,6 @@
#include <QMap>
#include <QQueue>
#include "include/config_manager.h"
#include "include/logger/u_logger_datatypes.h"
/**
* @brief The Universal Logger class to provide a common place to handle, store and write logs to file.
@ -48,43 +47,43 @@ public slots:
* @brief Adds an IC log entry to the area buffer and writes it to the respective log format.
* @param MessageLog containing client information and the actual message.
*/
void logIC(MessageLog f_log);
void logIC();
/**
* @brief Adds an OOC log entry to the area buffer and writes it to the respective log format.
* @param MessageLog containing client information and the actual message.
*/
void logOOC(MessageLog f_log);
void logOOC();
/**
* @brief Adds an login attempt to the area buffer and writes it to the respective log format.
* @param LoginLog containing info about the login attempt.
*/
void logLogin(LoginLog f_log);
void logLogin();
/**
* @brief Adds a command usage to the area buffer and writes it to the respective log format.
* @param ComandLog containing information about the command and parameter used.
*/
void logCMD(CommandLog f_log);
void logCMD();
/**
* @brief Adds a player kick to the area buffer and writes it to the respective log format.
* @param ModerativeLog containing information about the client kicked and who kicked them.
*/
void logKick(ModerativeLog f_log);
void logKick();
/**
* @brief Adds a player ban to the area buffer and writes it to the respective log format.
* @param ModerativeLog containing information about the client banned and who banned them.
*/
void logBan(ModerativeLog f_log);
void logBan();
/**
* @brief Logs any connection attempt to the server, wether sucessful or not.
* @param ConnectionLog containing information on who connected and if the connection was successful.
*/
void logConnectionAttempt(ConnectionLog f_log);
void logConnectionAttempt();
private:

View File

@ -1,112 +0,0 @@
//////////////////////////////////////////////////////////////////////////////////////
// akashi - a server for Attorney Online 2 //
// Copyright (C) 2020 scatterflower //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU Affero General Public License as //
// published by the Free Software Foundation, either version 3 of the //
// License, or (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU Affero General Public License for more details. //
// //
// You should have received a copy of the GNU Affero General Public License //
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
//////////////////////////////////////////////////////////////////////////////////////
#ifndef U_LOGGER_DATATYPES_H
#define U_LOGGER_DATATYPES_H
#include <QString>
#include "include/area_data.h"
/**
* @brief Convenience class to transport IC and OOC messages to the logger.
*/
class MessageLog {
public:
explicit MessageLog();
struct m_content {
QString charName;
QString oocName;
QString ipid;
QString hdid;
QString message;
AreaData* area;
};
m_content content;
};
/**
* @brief Convenience class to transport information of moderator actions to the logger
*
* @details The only two moderator commands who take advantage of this are ban and kick.
*/
class ModerativeLog {
public:
explicit ModerativeLog();
struct m_content {
QString moderatorName;
QString ipid;
QString hdid;
QString targetName;
QString targetOOCName;
QString targetIPID;
QString targetHDID;
AreaData* area;
};
m_content content;
};
/**
* @brief Convenience class to transport command usage information to the logger.
*/
class CommandLog {
public:
explicit CommandLog();
struct m_content {
QString charName;
QString oocName;
QString ipid;
QString hdid;
QString command;
QString cmdArgs;
AreaData* area;
};
m_content content;
};
/**
* @brief Convenience class to transport login attempt information to the logger.
*/
class LoginLog {
public:
explicit LoginLog();
struct m_content {
QString charName;
QString oocName;
QString ipid;
QString hdid;
bool success;
QString modname;
};
m_content content;
};
/**
* @brief Convenience class to transport connection event information to the logger.
*/
class ConnectionLog {
public:
explicit ConnectionLog();
struct m_content {
QString ip_address;
QString hdid;
QString ipid;
bool success;
};
m_content content;
};
#endif // U_LOGGER_DATATYPES_H

View File

@ -23,39 +23,39 @@ ULogger::ULogger(QObject* parent) :
}
void ULogger::logIC(MessageLog f_log)
void ULogger::logIC()
{
Q_UNUSED(f_log)
}
void ULogger::logOOC(MessageLog f_log)
void ULogger::logOOC()
{
Q_UNUSED(f_log)
}
void ULogger::logLogin(LoginLog f_log)
void ULogger::logLogin()
{
Q_UNUSED(f_log)
}
void ULogger::logCMD(CommandLog f_log)
void ULogger::logCMD()
{
Q_UNUSED(f_log)
}
void ULogger::logKick(ModerativeLog f_log)
void ULogger::logKick()
{
Q_UNUSED(f_log)
}
void ULogger::logBan(ModerativeLog f_log)
void ULogger::logBan()
{
Q_UNUSED(f_log)
}
void ULogger::logConnectionAttempt(ConnectionLog f_log)
void ULogger::logConnectionAttempt()
{
Q_UNUSED(f_log)
}
void ULogger::updateAreaBuffer(const QString& f_areaName, const QString& f_entry)