SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
qtwebapp::DualFileLogger Class Reference

#include <dualfilelogger.h>

+ Inheritance diagram for qtwebapp::DualFileLogger:
+ Collaboration diagram for qtwebapp::DualFileLogger:

Public Member Functions

 DualFileLogger (QSettings *firstSettings, QSettings *secondSettings, const int refreshInterval=10000, QObject *parent=0)
 
virtual void log (const QtMsgType type, const QString &message, const QString &file="", const QString &function="", const int line=0)
 
virtual void clear (const bool buffer=true, const bool variables=true)
 
- Public Member Functions inherited from qtwebapp::Logger
 Logger (QObject *parent)
 
 Logger (const QString msgFormat="{timestamp} {type} {msg}", const QString timestampFormat="yyyy-MM-dd HH:mm:ss.zzz", const QtMsgType minLevel=QtDebugMsg, const int bufferSize=0, QObject *parent=0)
 
virtual ~Logger ()
 
void installMsgHandler ()
 
void setMinMessageLevel (const QtMsgType &minMsgLevel)
 
QtMsgType getMinMessageLevel () const
 

Private Attributes

FileLoggerfirstLogger
 
FileLoggersecondLogger
 

Additional Inherited Members

- Static Public Member Functions inherited from qtwebapp::Logger
static void set (const QString &name, const QString &value)
 
- Protected Member Functions inherited from qtwebapp::Logger
virtual void write (const LogMessage *logMessage)
 
- Protected Attributes inherited from qtwebapp::Logger
QString msgFormat
 
QString timestampFormat
 
QtMsgType minLevel
 
int bufferSize
 
- Static Protected Attributes inherited from qtwebapp::Logger
static QMutex mutex
 

Detailed Description

Logs messages into two log files simultaneously. May be used to create two logfiles with different configuration settings.

See also
FileLogger for a description of the two underlying loggers.

Definition at line 26 of file dualfilelogger.h.

Constructor & Destructor Documentation

◆ DualFileLogger()

DualFileLogger::DualFileLogger ( QSettings *  firstSettings,
QSettings *  secondSettings,
const int  refreshInterval = 10000,
QObject *  parent = 0 
)

Constructor.

Parameters
firstSettingsConfiguration settings for the first log file, usually stored in an INI file. Must not be 0. Settings are read from the current group, so the caller must have called settings->beginGroup(). Because the group must not change during runtime, it is recommended to provide a separate QSettings instance to the logger that is not used by other parts of the program.
secondSettingsSame as firstSettings, but for the second log file.
refreshIntervalInterval of checking for changed config settings in msec, or 0=disabled
parentParent object.

Definition at line 10 of file dualfilelogger.cpp.

References firstLogger, and secondLogger.

11  :Logger(parent)
12 {
13  firstLogger=new FileLogger(firstSettings, refreshInterval, this);
14  secondLogger=new FileLogger(secondSettings, refreshInterval, this);
15 }
Logger(QObject *parent)
Definition: logger.cpp:25

Member Function Documentation

◆ clear()

void DualFileLogger::clear ( const bool  buffer = true,
const bool  variables = true 
)
virtual

Clear the thread-local data of the current thread. This method is thread safe.

Parameters
bufferWhether to clear the backtrace buffer
variablesWhether to clear the log variables

Reimplemented from qtwebapp::Logger.

Definition at line 23 of file dualfilelogger.cpp.

References qtwebapp::Logger::clear(), firstLogger, and secondLogger.

24 {
25  firstLogger->clear(buffer,variables);
26  secondLogger->clear(buffer,variables);
27 }
virtual void clear(const bool buffer=true, const bool variables=true)
Definition: logger.cpp:134
+ Here is the call graph for this function:

◆ log()

void DualFileLogger::log ( const QtMsgType  type,
const QString &  message,
const QString &  file = "",
const QString &  function = "",
const int  line = 0 
)
virtual

Decorate and log the message, if type>=minLevel. This method is thread safe.

Parameters
typeMessage type (level)
messageMessage text
fileName of the source file where the message was generated (usually filled with the macro FILE)
functionName of the function where the message was generated (usually filled with the macro LINE)
lineLine Number of the source file, where the message was generated (usually filles with the macro func or FUNCTION)
See also
LogMessage for a description of the message decoration.

Reimplemented from qtwebapp::Logger.

Definition at line 17 of file dualfilelogger.cpp.

References firstLogger, qtwebapp::Logger::log(), and secondLogger.

18 {
19  firstLogger->log(type,message,file,function,line);
20  secondLogger->log(type,message,file,function,line);
21 }
virtual void log(const QtMsgType type, const QString &message, const QString &file="", const QString &function="", const int line=0)
Definition: logger.cpp:153
+ Here is the call graph for this function:

Member Data Documentation

◆ firstLogger

FileLogger* qtwebapp::DualFileLogger::firstLogger
private

First logger

Definition at line 67 of file dualfilelogger.h.

Referenced by clear(), DualFileLogger(), and log().

◆ secondLogger

FileLogger* qtwebapp::DualFileLogger::secondLogger
private

Second logger

Definition at line 70 of file dualfilelogger.h.

Referenced by clear(), DualFileLogger(), and log().


The documentation for this class was generated from the following files: