Index: sources/storage/Logger.cpp =================================================================== diff -u -r7ebc073150532073ae7f1a0e768272bcff5d6fb3 -r465a935949a85d3d1bebd11979737ff38ef96122 --- sources/storage/Logger.cpp (.../Logger.cpp) (revision 7ebc073150532073ae7f1a0e768272bcff5d6fb3) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision 465a935949a85d3d1bebd11979737ff38ef96122) @@ -141,6 +141,8 @@ connect(&_removeLogsWatcher, SIGNAL(finished ()), this , SLOT(onRemoveLogs())); + connect(&_DeviceController, SIGNAL( didSDCardStateChange(bool, bool)), + this , SLOT( onSDCardStateChange(bool, bool))); connect(&_DeviceController, SIGNAL( didSDCardSpaceChange(bool, qint64, qint64, quint8)), this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); } @@ -183,6 +185,15 @@ void Logger::onLog(const QString &vContent, LogType vLogType, bool vTimestamp) { + static bool notified = false; + if ( ! _logStorageReady && ! gDisableSDCFailLogStop ) { + if ( ! notified ) { + notified = true; + qDebug() << "Log storage not ready, logging rejected"; + } + return; + } + log(vContent, vLogType, vTimestamp); } @@ -557,6 +568,17 @@ } // disabled coco end +void Logger::onSDCardStateChange(bool vReady, bool vReadonly) +{ +#if BUILD_FOR_DESKTOP + Q_UNUSED(vReady ) + Q_UNUSED(vReadonly ) + _logStorageReady = true; +#else + _logStorageReady = vReady && !vReadonly; +#endif +} + /*! * \brief Logger::onSDCardSpaceChange * \details SD Card storage space parameter change slot. @@ -575,6 +597,7 @@ Q_UNUSED(vTotal ) Q_UNUSED(vAvailable ) if ( ! vReady ) return; + // DEBUG: qDebug() << vPercent << Storage::Available_Space_Percent; if ( Storage::Log_Min_Available_Total_Space_IsLow(vPercent) ) { concurrentRemoveLogs();