From fec1722697dca1f26c6570c94cae504eec3280cf Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Fri, 10 Sep 2021 20:38:27 +0200 Subject: [PATCH] Overload flush method and un-stupid the switch case --- core/include/logger/writer_full.h | 2 +- core/src/logger/u_logger.cpp | 6 +----- core/src/logger/writer_full.cpp | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/include/logger/writer_full.h b/core/include/logger/writer_full.h index 33abe87..6156332 100644 --- a/core/include/logger/writer_full.h +++ b/core/include/logger/writer_full.h @@ -55,7 +55,7 @@ public: * @param Preformatted QString which will be written into the logfile * @param Area name of the target logfile. */ - void flushArea(const QString f_entry, const QString f_areaName); + void flush(const QString f_entry, const QString f_areaName); private: /** diff --git a/core/src/logger/u_logger.cpp b/core/src/logger/u_logger.cpp index badc6d8..c416a3b 100644 --- a/core/src/logger/u_logger.cpp +++ b/core/src/logger/u_logger.cpp @@ -25,8 +25,6 @@ ULogger::ULogger(QObject* parent) : writerModcall = new WriterModcall; break; case DataTypes::LogType::FULL : - writerFull = new WriterFull; - break; case DataTypes::LogType::FULLAREA : writerFull = new WriterFull; break; @@ -40,8 +38,6 @@ ULogger::~ULogger() writerModcall->deleteLater(); break; case DataTypes::LogType::FULL : - writerFull->deleteLater(); - break; case DataTypes::LogType::FULLAREA : writerFull->deleteLater(); break; @@ -155,7 +151,7 @@ void ULogger::updateAreaBuffer(const QString& f_areaName, const QString& f_logEn writerFull->flush(f_logEntry); } if (ConfigManager::loggingType() == DataTypes::LogType::FULLAREA) { - writerFull->flushArea(f_logEntry, f_areaName); + writerFull->flush(f_logEntry, f_areaName); } } diff --git a/core/src/logger/writer_full.cpp b/core/src/logger/writer_full.cpp index 6a6827c..ea99842 100644 --- a/core/src/logger/writer_full.cpp +++ b/core/src/logger/writer_full.cpp @@ -37,7 +37,7 @@ void WriterFull::flush(const QString f_entry) l_logfile.close(); } -void WriterFull::flushArea(const QString f_entry, const QString f_areaName) +void WriterFull::flush(const QString f_entry, const QString f_areaName) { l_logfile.setFileName(QString("logs/%1_%2.log").arg(f_areaName, QDate::currentDate().toString("yyyy-MM-dd")));