kopia lustrzana https://github.com/f4exb/sdrangel
Put application and system info at the start of the log file if it is being used
rodzic
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)
|
void LoggerWithFile::clear(const bool buffer, const bool variables)
|
||||||
{
|
{
|
||||||
consoleLogger->clear(buffer,variables);
|
consoleLogger->clear(buffer,variables);
|
||||||
|
|
|
@ -74,6 +74,9 @@ public:
|
||||||
void getFileMinMessageLevelStr(QString& levelStr);
|
void getFileMinMessageLevelStr(QString& levelStr);
|
||||||
void getLogFileName(QString& fileName);
|
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:
|
private:
|
||||||
/** First console logger */
|
/** First console logger */
|
||||||
Logger* consoleLogger;
|
Logger* consoleLogger;
|
||||||
|
|
|
@ -1725,6 +1725,25 @@ void MainWindow::setLoggingOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_logger->setUseFileLogger(m_settings.getUseLogFile());
|
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)
|
void MainWindow::focusHasChanged(QWidget *oldWidget __attribute__((unused)), QWidget *newWidget)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QSysInfo>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
@ -216,6 +217,25 @@ void MainCore::setLoggingOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_logger->setUseFileLogger(m_settings.getUseLogFile());
|
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()
|
void MainCore::addSinkDevice()
|
||||||
|
|
Ładowanie…
Reference in New Issue