1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Logger: new getters

This commit is contained in:
f4exb 2017-11-18 20:07:53 +01:00
parent 93d36b20a4
commit 877d6f6fe0
3 changed files with 62 additions and 0 deletions

View File

@ -99,6 +99,13 @@ public:
minLevel = minMsgLevel;
}
/**
* Get the current message level
*/
QtMsgType getMinMessageLevel() const {
return minLevel;
}
/**
Sets a thread-local variable that may be used to decorate log messages.
This method is thread safe.

View File

@ -68,3 +68,54 @@ void LoggerWithFile::setFileMinMessageLevel(const QtMsgType& msgLevel)
fileLogger->setMinMessageLevel(msgLevel);
}
}
void LoggerWithFile::getConsoleMinMessageLevelStr(QString& levelStr)
{
switch (consoleLogger->getMinMessageLevel())
{
case QtDebugMsg:
levelStr = "debug";
break;
case QtInfoMsg:
levelStr = "info";
break;
case QtWarningMsg:
levelStr = "warning";
break;
case QtCriticalMsg:
case QtFatalMsg:
levelStr = "error";
break;
default:
levelStr = "debug";
break;
}
}
void LoggerWithFile::getFileMinMessageLevelStr(QString& levelStr)
{
switch (fileLogger->getMinMessageLevel())
{
case QtDebugMsg:
levelStr = "debug";
break;
case QtInfoMsg:
levelStr = "info";
break;
case QtWarningMsg:
levelStr = "warning";
break;
case QtCriticalMsg:
case QtFatalMsg:
levelStr = "error";
break;
default:
levelStr = "debug";
break;
}
}
void LoggerWithFile::getLogFileName(QString& fileName)
{
fileName = fileLogger->getFileLoggerSettings().fileName;
}

View File

@ -70,6 +70,10 @@ public:
void setConsoleMinMessageLevel(const QtMsgType& msgLevel);
void setFileMinMessageLevel(const QtMsgType& msgLevel);
void getConsoleMinMessageLevelStr(QString& levelStr);
void getFileMinMessageLevelStr(QString& levelStr);
void getLogFileName(QString& fileName);
private:
/** First console logger */
Logger* consoleLogger;