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.
|
#include <loggerwithfile.h>
Public Member Functions | |
LoggerWithFile (QObject *parent=0) | |
virtual | ~LoggerWithFile () |
void | createOrSetFileLogger (const FileLoggerSettings &settings, const int refreshInterval=10000) |
void | destroyFileLogger () |
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) |
bool | getUseFileLogger () const |
void | setUseFileLogger (bool use) |
bool | hasFileLogger () const |
FileLoggerSettings | getFileLoggerSettings () const |
void | setFileLoggerSettings (const FileLoggerSettings &settings) |
void | setConsoleMinMessageLevel (const QtMsgType &msgLevel) |
void | setFileMinMessageLevel (const QtMsgType &msgLevel) |
void | getConsoleMinMessageLevelStr (QString &levelStr) |
void | getFileMinMessageLevelStr (QString &levelStr) |
void | getLogFileName (QString &fileName) |
void | logToFile (const QtMsgType type, const QString &message, const QString &file="", const QString &function="", const int line=0) |
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 | |
Logger * | consoleLogger |
FileLogger * | fileLogger |
bool | useFileFlogger |
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 |
Logs messages to console and optionally to a file simultaneously.
Definition at line 25 of file loggerwithfile.h.
LoggerWithFile::LoggerWithFile | ( | QObject * | parent = 0 | ) |
Definition at line 12 of file loggerwithfile.cpp.
References consoleLogger, and qtwebapp::Logger::Logger().
|
virtual |
Definition at line 18 of file loggerwithfile.cpp.
References consoleLogger, and destroyFileLogger().
|
virtual |
Clear the thread-local data of the current thread. This method is thread safe.
buffer | Whether to clear the backtrace buffer |
variables | Whether to clear the log variables |
Reimplemented from qtwebapp::Logger.
Definition at line 58 of file loggerwithfile.cpp.
References qtwebapp::Logger::clear(), consoleLogger, fileLogger, and useFileFlogger.
void LoggerWithFile::createOrSetFileLogger | ( | const FileLoggerSettings & | settings, |
const int | refreshInterval = 10000 |
||
) |
Definition at line 24 of file loggerwithfile.cpp.
References fileLogger, and qtwebapp::FileLogger::setFileLoggerSettings().
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
void LoggerWithFile::destroyFileLogger | ( | ) |
Definition at line 33 of file loggerwithfile.cpp.
References fileLogger.
Referenced by ~LoggerWithFile().
void LoggerWithFile::getConsoleMinMessageLevelStr | ( | QString & | levelStr | ) |
Definition at line 79 of file loggerwithfile.cpp.
References consoleLogger, and qtwebapp::Logger::getMinMessageLevel().
Referenced by WebAPIAdapterGUI::instanceLoggingGet(), WebAPIAdapterSrv::instanceLoggingGet(), WebAPIAdapterSrv::instanceSummary(), and WebAPIAdapterGUI::instanceSummary().
|
inline |
Get a file logger settings copy
Definition at line 64 of file loggerwithfile.h.
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
void LoggerWithFile::getFileMinMessageLevelStr | ( | QString & | levelStr | ) |
Definition at line 102 of file loggerwithfile.cpp.
References fileLogger, and qtwebapp::Logger::getMinMessageLevel().
Referenced by WebAPIAdapterGUI::instanceLoggingGet(), WebAPIAdapterSrv::instanceLoggingGet(), WebAPIAdapterSrv::instanceSummary(), and WebAPIAdapterGUI::instanceSummary().
void LoggerWithFile::getLogFileName | ( | QString & | fileName | ) |
Definition at line 125 of file loggerwithfile.cpp.
References fileLogger, qtwebapp::FileLoggerSettings::fileName, and qtwebapp::FileLogger::getFileLoggerSettings().
Referenced by WebAPIAdapterGUI::instanceLoggingGet(), WebAPIAdapterSrv::instanceLoggingGet(), WebAPIAdapterSrv::instanceSummary(), and WebAPIAdapterGUI::instanceSummary().
|
inline |
Definition at line 56 of file loggerwithfile.h.
Referenced by WebAPIAdapterGUI::instanceLoggingGet(), WebAPIAdapterSrv::instanceLoggingGet(), WebAPIAdapterSrv::instanceSummary(), and WebAPIAdapterGUI::instanceSummary().
|
inline |
Definition at line 58 of file loggerwithfile.h.
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
|
virtual |
Decorate and log the message, if type>=minLevel. This method is thread safe.
type | Message type (level) |
message | Message text |
file | Name of the source file where the message was generated (usually filled with the macro FILE) |
function | Name of the function where the message was generated (usually filled with the macro LINE) |
line | Line Number of the source file, where the message was generated (usually filles with the macro func or FUNCTION) |
Reimplemented from qtwebapp::Logger.
Definition at line 42 of file loggerwithfile.cpp.
References consoleLogger, fileLogger, qtwebapp::Logger::log(), and useFileFlogger.
void LoggerWithFile::logToFile | ( | const QtMsgType | type, |
const QString & | message, | ||
const QString & | file = "" , |
||
const QString & | function = "" , |
||
const int | line = 0 |
||
) |
This will log to file only
Definition at line 51 of file loggerwithfile.cpp.
References fileLogger, qtwebapp::Logger::log(), and useFileFlogger.
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
void LoggerWithFile::setConsoleMinMessageLevel | ( | const QtMsgType & | msgLevel | ) |
Definition at line 67 of file loggerwithfile.cpp.
References consoleLogger, and qtwebapp::Logger::setMinMessageLevel().
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
|
inline |
Set new file logger settings data
File | logger settings to replace current data |
Definition at line 70 of file loggerwithfile.h.
void LoggerWithFile::setFileMinMessageLevel | ( | const QtMsgType & | msgLevel | ) |
Definition at line 72 of file loggerwithfile.cpp.
References fileLogger, and qtwebapp::Logger::setMinMessageLevel().
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
|
inline |
Definition at line 57 of file loggerwithfile.h.
Referenced by MainCore::setLoggingOptions(), and MainWindow::setLoggingOptions().
|
private |
First console logger
Definition at line 84 of file loggerwithfile.h.
Referenced by clear(), getConsoleMinMessageLevelStr(), log(), LoggerWithFile(), setConsoleMinMessageLevel(), and ~LoggerWithFile().
|
private |
Second file logger
Definition at line 87 of file loggerwithfile.h.
Referenced by clear(), createOrSetFileLogger(), destroyFileLogger(), getFileMinMessageLevelStr(), getLogFileName(), log(), logToFile(), and setFileMinMessageLevel().
|
private |
Use file logger indicator
Definition at line 90 of file loggerwithfile.h.
Referenced by clear(), log(), and logToFile().