From e4ccb9c3e8baae8632d52ec7158f64eabc2b4d76 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Tue, 10 Nov 2015 21:48:29 +0100 Subject: Add logging --- src/CRSMLogging.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/CRSMLogging.hpp (limited to 'src/CRSMLogging.hpp') diff --git a/src/CRSMLogging.hpp b/src/CRSMLogging.hpp new file mode 100644 index 0000000..7f30b3e --- /dev/null +++ b/src/CRSMLogging.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include + +#include "ClientInfo.hpp" + +class ScenarioSettings; + +class CRSMLogging +{ + QString logFolder; + QString mainLogName; + QString timestampFormat; + QFile mainLog; + QMap logFiles; + + const char* cmdLogsFolder = "cmd/"; + const char* ircLogsFolder = "irc/"; + const char* modLogsFolder = "mod/"; + const char* userLogsFolder = "usr/"; + const char* clonkLogFile = "clonk"; + const char* clonkChatLogFile = "clonk.chat"; + const char* scensLogFile = "scenarios"; +public: + CRSMLogging(); + + QString setLogFolder(const QString& folder); + QString setMainLog(const QString& fileName); + void setTimestampFormat(const QString& format); + void log(const QString& message, const QString logFile = ""); + void clonkUserLog(const QString& message, const ClientInfo& client, bool action, bool command = false, bool response = false); + void modLog(const QString& message, const ClientInfo& client, const QString& modName, bool response); + void commandLog(const QString& message, const ClientInfo& client, bool response); + void ircLog(const QString& message, const QString &nick, bool query = false, QString channel = "", bool action = false, bool notice = false, bool response = false); + void ircUserLog(const QString& message, const ClientInfo &client, bool query, const QString &channel, bool action, bool notice); + void clonkChatLog(const QString& message); + void clonkLog(const QString& message); + void scenLog(const ScenarioSettings& scen); + QString formatIrcNick(const QString& nick, bool noChannel, const QString& channel, bool action, bool notice); +}; -- cgit v1.2.3-54-g00ecf