Index: sources/storage/Logger.h =================================================================== diff -u -rae1042a0c14d6d27556730183cc2cbe1a00bc0a7 -ra3030123e885fb9f22dea5839c4e988896a257e4 --- sources/storage/Logger.h (.../Logger.h) (revision ae1042a0c14d6d27556730183cc2cbe1a00bc0a7) +++ sources/storage/Logger.h (.../Logger.h) (revision a3030123e885fb9f22dea5839c4e988896a257e4) @@ -33,6 +33,8 @@ #define LOG_EVENT(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogEvent) #define LOG_DATUM(vCONTENT) emit Storage::Logger::I().didLog(vCONTENT, Storage::Logger::LogType::eLogDatum) +#define MIXED_EVENT_DATUM + // forward declarations class tst_logging; @@ -99,25 +101,33 @@ { LogType::eLogDebug, "" }, // it has its own file and all the content is Error }; - const QHash _logTypeName { // Will be used for for information - { LogType::eLogEvent, "Event" }, - { LogType::eLogDatum, "Datum" }, - { LogType::eLogDebug, "Error" }, // it has its own file and all the content is Error - }; - const QHash _logFileNameExt { { LogType::eLogEvent, ".log" }, +#ifdef MIXED_EVENT_DATUM { LogType::eLogDatum, ".log" }, +#else + { LogType::eLogDatum, ".dat" }, +#endif { LogType::eLogDebug, ".err" }, }; - const QHash _logTypeExpiryDay { - { LogType::eLogEvent, 15 }, // in days - { LogType::eLogDatum, 15 }, // in days - { LogType::eLogDebug, 5 }, // in days + // be careful when defining these percentages + // 1 - Since now both the Log and Datum are in the same place and file they have same percentage. + // if separated then the percentage has to be separated + // 2 - the total in _logTypeExpiryDay in not 100 and it has to be summed up with _availableSpacePercent. + // so it is 70% for Event/Datum + 15% Service + 15% free = 100% total + const QHash _logTypeMaxUsageLimit { +#ifdef MIXED_EVENT_DATUM + { LogType::eLogEvent, 70 }, // in days + { LogType::eLogDatum, 70 }, // in days +#else + { LogType::eLogEvent, 35 }, // in days + { LogType::eLogDatum, 35 }, // in days +#endif + { LogType::eLogDebug, 15 }, // in days }; - const qint8 _availableSpacePercent = 25; // currently 16G SD-Card so 4G should always be available. + const qint8 _availableSpacePercent = 15; // currently 16G SD-Card so 2.4G should always be available. const char *_dateFormat = "yyyy_MM_dd"; const char *_timeFormat = "HH:mm:ss"; @@ -128,6 +138,7 @@ bool _enableConsoleOut = false; QString _logFileName = ""; + QMutex _logRemoveRunning; QFutureWatcher _exportLogsWatcher; QFutureWatcher _removeLogsWatcher; @@ -174,7 +185,14 @@ bool concurrentRemoveLogs(); void onRemoveLogs(); signals: - void didRemoveLogs(); + /*! + * \brief didRemoveLogs + * \details This signal will be emitted mainly for DriveWatcher to not to emit the signal that Logger is connected to + * , while the logging cleanup is in progress, otherwise if the log cleanup takes more that 1sec (current interval) + * in the DriveWatcher then the cleanup will be called again for no good reason. + * \param vInProgress - true if the log cleanup is in progress, false otherwise. + */ + void didRemoveLogs(bool vInProgress); // ----- Available space is low private slots: @@ -193,6 +211,6 @@ * \param vContent - content as type of string to be logged * \param vLogType - the type of logging of type Storage::Logger::LogType */ - void didLog (const QString &vContent, LogType vLogType); + void didLog (const QString &vContent, LogType vLogType); }; }