Index: sources/storage/logger.h =================================================================== diff -u -r30f83b2813e68ae3c2806399bf808b642c215b67 -rd04653f0fbf1ed98178b6c7094beb4ec226a777f --- sources/storage/logger.h (.../logger.h) (revision 30f83b2813e68ae3c2806399bf808b642c215b67) +++ sources/storage/logger.h (.../logger.h) (revision d04653f0fbf1ed98178b6c7094beb4ec226a777f) @@ -70,30 +70,31 @@ private: QDir _dir; + QString _prefix; QHash _logPathNames; - QHash _logBasePathNames { - { LogType::eLogBasic, "log/" }, - { LogType::eLogEvent, "log/" }, - { LogType::eLogDatum, "log/" }, - { LogType::eLogError, "log/" }, + const QHash _logBasePathNames { + { LogType::eLogBasic, "log/" }, + { LogType::eLogEvent, "log/" }, + { LogType::eLogDatum, "log/" }, + { LogType::eLogError, "service/" }, }; - QHash _logPrefix { // Will be used for the logging in the file + const QHash _logPrefix { // Will be used for the logging in the file { LogType::eLogBasic, "" }, // Object itself tells what it is { LogType::eLogEvent, "E" }, { LogType::eLogDatum, "D" }, { LogType::eLogError, "" }, // it has its own file and all the content is Error }; - QHash _logTypeName { // Will be used for for information + const QHash _logTypeName { // Will be used for for information { LogType::eLogBasic, "Basic" }, // Object itself tells what it is - { LogType::eLogEvent, "Event" }, - { LogType::eLogDatum, "Datum" }, + { LogType::eLogEvent, "Event" }, + { LogType::eLogDatum, "Datum" }, { LogType::eLogError, "Error" }, // it has its own file and all the content is Error }; - QHash _logFileNameBase { - { LogType::eLogBasic, "denali.log" }, - { LogType::eLogEvent, "denali.log" }, - { LogType::eLogDatum, "denali.log" }, - { LogType::eLogError, "denali.err" }, + const QHash _logFileNameExt { + { LogType::eLogBasic, ".log" }, + { LogType::eLogEvent, ".log" }, + { LogType::eLogDatum, ".log" }, + { LogType::eLogError, ".err" }, }; const char *_dateFormat = "yyyy_MM_dd"; @@ -105,7 +106,10 @@ QString _logFileName = ""; QFutureWatcher _exportWatcher; + QFutureWatcher _removeOldLogsWatcher; + const quint8 _removeOldLogsDaysOlderThan = 3; + QThread *_thread = nullptr; bool _init = false; @@ -144,6 +148,13 @@ */ void didExport(); +// ----- Remove Old Logs structure +private slots: + bool concurrentRemoveOldLogs(); + void onRemoveOldLogs(); +signals: + void didRemoveOldLogs(); + // ----- logging structure private slots: void onLog (const QString &vContent, LogType vLogType);