Utility function to directly log warning when network not accessible

This commit is contained in:
Klaus Basan
2017-07-11 20:03:24 +02:00
committed by Mathew Sutcliffe
parent 8aed8f598e
commit 76b3b6c0b6
7 changed files with 16 additions and 33 deletions

View File

@@ -11,6 +11,7 @@
#include "blackcore/application.h"
#include "blackmisc/network/networkutils.h"
#include "blackmisc/threadutils.h"
#include "blackmisc/logmessage.h"
#include <QCoreApplication>
#include <QMetaObject>
@@ -66,9 +67,14 @@ namespace BlackCore
return delta <= timeLastMs;
}
bool CThreadedReader::isNetworkAccessible() const
bool CThreadedReader::isNetworkAccessible(const QString &logWarningMessage) const
{
return sApp->isNetworkAccessible();
const bool a = sApp->isNetworkAccessible();
if (!a && !logWarningMessage.isEmpty())
{
CLogMessage(this).warning(logWarningMessage);
}
return a;
}
void CThreadedReader::startReader()