1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-25 19:44:12 -04:00

Logging: added a console and optional dual file logger

This commit is contained in:
f4exb
2017-11-11 23:44:05 +01:00
parent 85e8f099c7
commit 423cc62e12
4 changed files with 123 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
/*
* loggerwithfile.cpp
*
* Created on: Nov 11, 2017
* Author: f4exb
*/
#include "loggerwithfile.h"
using namespace qtwebapp;
LoggerWithFile::LoggerWithFile(QObject* parent)
:Logger(parent), fileLogger(0), useFileFlogger(false)
{
consoleLogger = new Logger(this);
}
void LoggerWithFile::createFileLogger(const FileLoggerSettings& settings, const int refreshInterval)
{
fileLogger = new FileLogger(settings, refreshInterval, this);
}
void LoggerWithFile::log(const QtMsgType type, const QString& message, const QString &file, const QString &function, const int line)
{
consoleLogger->log(type,message,file,function,line);
if (fileLogger && useFileFlogger) {
fileLogger->log(type,message,file,function,line);
}
}
void LoggerWithFile::clear(const bool buffer, const bool variables)
{
consoleLogger->clear(buffer,variables);
if (fileLogger && useFileFlogger) {
fileLogger->clear(buffer,variables);
}
}