From 4d20facc334a803a4eb233cbe8723eb36274ee42 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Tue, 24 Aug 2021 23:43:35 +0200 Subject: [PATCH] Add basic constructor --- core/include/data_types.h | 3 ++- core/include/logger/u_logger.h | 18 ++++++++++++++++++ core/src/logger/u_logger.cpp | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/core/include/data_types.h b/core/include/data_types.h index e485c8d..0a6e397 100644 --- a/core/include/data_types.h +++ b/core/include/data_types.h @@ -41,7 +41,8 @@ public: */ enum class LogType { MODCALL, - FULL + FULL, + SQL }; Q_ENUM(LogType) }; diff --git a/core/include/logger/u_logger.h b/core/include/logger/u_logger.h index 77ee5b2..5afc3f3 100644 --- a/core/include/logger/u_logger.h +++ b/core/include/logger/u_logger.h @@ -23,6 +23,9 @@ #include #include #include "include/config_manager.h" +#include "include/logger/writer_full.h" +#include "include/logger/writer_modcall.h" +#include "include/logger/writer_sql.h" /** * @brief The Universal Logger class to provide a common place to handle, store and write logs to file. @@ -105,6 +108,21 @@ private: * @details This QMap uses the area name as the index key to access its respective buffer. */ QMap> m_bufferMap; + + /** + * @brief Pointer to modcall writer. Handles QQueue delogging into area specific file. + */ + WriterModcall* writerModcall; + + /** + * @brief Pointer to full writer. Handles single messages in one file. + */ + WriterFull* writerFull; + + /** + * @brief Pointer to SQL writer. Handles execution of log SQL queries. + */ + WriterSQL* writerSQL; }; #endif //U_LOGGER_H diff --git a/core/src/logger/u_logger.cpp b/core/src/logger/u_logger.cpp index 20f3a98..d9049ea 100644 --- a/core/src/logger/u_logger.cpp +++ b/core/src/logger/u_logger.cpp @@ -21,6 +21,14 @@ ULogger::ULogger(QObject* parent) : QObject(parent) { + switch (ConfigManager::loggingType()) { + case DataTypes::LogType::MODCALL : + writerModcall = new WriterModcall; + case DataTypes::LogType::FULL : + writerFull = new WriterFull; + case DataTypes::LogType::SQL : + writerSQL = new WriterSQL; + } } void ULogger::logIC(const QString& f_charName, const QString& f_oocName, const QString& f_ipid,