Overload flush method and un-stupid the switch case

This commit is contained in:
Salanto 2021-09-10 20:38:27 +02:00
parent c7181dfcd6
commit fec1722697
3 changed files with 3 additions and 7 deletions

View File

@ -55,7 +55,7 @@ public:
* @param Preformatted QString which will be written into the logfile * @param Preformatted QString which will be written into the logfile
* @param Area name of the target 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: private:
/** /**

View File

@ -25,8 +25,6 @@ ULogger::ULogger(QObject* parent) :
writerModcall = new WriterModcall; writerModcall = new WriterModcall;
break; break;
case DataTypes::LogType::FULL : case DataTypes::LogType::FULL :
writerFull = new WriterFull;
break;
case DataTypes::LogType::FULLAREA : case DataTypes::LogType::FULLAREA :
writerFull = new WriterFull; writerFull = new WriterFull;
break; break;
@ -40,8 +38,6 @@ ULogger::~ULogger()
writerModcall->deleteLater(); writerModcall->deleteLater();
break; break;
case DataTypes::LogType::FULL : case DataTypes::LogType::FULL :
writerFull->deleteLater();
break;
case DataTypes::LogType::FULLAREA : case DataTypes::LogType::FULLAREA :
writerFull->deleteLater(); writerFull->deleteLater();
break; break;
@ -155,7 +151,7 @@ void ULogger::updateAreaBuffer(const QString& f_areaName, const QString& f_logEn
writerFull->flush(f_logEntry); writerFull->flush(f_logEntry);
} }
if (ConfigManager::loggingType() == DataTypes::LogType::FULLAREA) { if (ConfigManager::loggingType() == DataTypes::LogType::FULLAREA) {
writerFull->flushArea(f_logEntry, f_areaName); writerFull->flush(f_logEntry, f_areaName);
} }
} }

View File

@ -37,7 +37,7 @@ void WriterFull::flush(const QString f_entry)
l_logfile.close(); 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"))); l_logfile.setFileName(QString("logs/%1_%2.log").arg(f_areaName, QDate::currentDate().toString("yyyy-MM-dd")));