mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Put application and system info at the start of the log file if it is being used
This commit is contained in:
parent
eca3527beb
commit
333df92c06
@ -48,6 +48,13 @@ void LoggerWithFile::log(const QtMsgType type, const QString& message, const QSt
|
||||
}
|
||||
}
|
||||
|
||||
void LoggerWithFile::logToFile(const QtMsgType type, const QString& message, const QString &file, const QString &function, const int line)
|
||||
{
|
||||
if (fileLogger && useFileFlogger) {
|
||||
fileLogger->log(type,message,file,function,line);
|
||||
}
|
||||
}
|
||||
|
||||
void LoggerWithFile::clear(const bool buffer, const bool variables)
|
||||
{
|
||||
consoleLogger->clear(buffer,variables);
|
||||
|
@ -74,6 +74,9 @@ public:
|
||||
void getFileMinMessageLevelStr(QString& levelStr);
|
||||
void getLogFileName(QString& fileName);
|
||||
|
||||
/** This will log to file only */
|
||||
void logToFile(const QtMsgType type, const QString& message, const QString &file="", const QString &function="", const int line=0);
|
||||
|
||||
private:
|
||||
/** First console logger */
|
||||
Logger* consoleLogger;
|
||||
|
@ -1725,6 +1725,25 @@ void MainWindow::setLoggingOptions()
|
||||
}
|
||||
|
||||
m_logger->setUseFileLogger(m_settings.getUseLogFile());
|
||||
|
||||
if (m_settings.getUseLogFile())
|
||||
{
|
||||
#if QT_VERSION >= 0x050400
|
||||
QString appInfoStr(tr("%1 v%2 Qt %3 %4 %5")
|
||||
.arg(qApp->applicationName())
|
||||
.arg(qApp->applicationVersion())
|
||||
.arg(QT_VERSION_STR)
|
||||
.arg(QSysInfo::currentCpuArchitecture())
|
||||
.arg(QSysInfo::prettyProductName()));
|
||||
#else
|
||||
QString appInfoStr(tr("%1 v%2 Qt %3")
|
||||
.arg(qApp->applicationName())
|
||||
.arg(qApp->applicationVersion())
|
||||
.arg(QT_VERSION_STR));
|
||||
#endif
|
||||
|
||||
m_logger->logToFile(QtInfoMsg, appInfoStr);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::focusHasChanged(QWidget *oldWidget __attribute__((unused)), QWidget *newWidget)
|
||||
|
@ -17,6 +17,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSysInfo>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dsp/dspengine.h"
|
||||
@ -216,6 +217,25 @@ void MainCore::setLoggingOptions()
|
||||
}
|
||||
|
||||
m_logger->setUseFileLogger(m_settings.getUseLogFile());
|
||||
|
||||
if (m_settings.getUseLogFile())
|
||||
{
|
||||
#if QT_VERSION >= 0x050400
|
||||
QString appInfoStr(tr("%1 v%2 Qt %3 %4 %5")
|
||||
.arg(QCoreApplication::instance()->applicationName())
|
||||
.arg(QCoreApplication::instance()->applicationVersion())
|
||||
.arg(QT_VERSION_STR)
|
||||
.arg(QSysInfo::currentCpuArchitecture())
|
||||
.arg(QSysInfo::prettyProductName()));
|
||||
#else
|
||||
QString appInfoStr(tr("%1 v%2 Qt %3")
|
||||
.arg(QCoreApplication::instance()->applicationName())
|
||||
.arg(QCoreApplication::instance()->applicationVersion())
|
||||
.arg(QT_VERSION_STR));
|
||||
#endif
|
||||
|
||||
m_logger->logToFile(QtInfoMsg, appInfoStr);
|
||||
}
|
||||
}
|
||||
|
||||
void MainCore::addSinkDevice()
|
||||
|
Loading…
Reference in New Issue
Block a user