QLogger
Loading...
Searching...
No Matches
QLogger::QLoggerFactory Class Referencefinal

Use to manage logs. More...

Public Member Functions

void initLoggerDaily (const QFileInfo &file, const QTime &time, uint maxFiles, bool enableConsole)
 Use to configure daily file log sink.
 
void initLoggerRotating (const QFileInfo &file, int maxFiles, qint64 maxSize, bool enableConsole)
 Use to configure rotating file log sink.
 
void desinit ()
 Use to release and close all used ressources.
 
void setLevel (QtMsgType idType)
 Use to set minimum log level to use.
 

Static Public Member Functions

static QLoggerFactoryinstance ()
 Use to get current unique instance of QLoggerFactory.
 
static const QVersionNumber & getLibraryVersion ()
 Retrieve library semantic version at runtime.
 

Detailed Description

Use to manage logs.

This class will allow to configure and manage logs messages.
Multiple sinks are available:

See also
initLoggerDaily(), initLoggerRotating()
instance()

Member Function Documentation

◆ desinit()

void QLogger::QLoggerFactory::desinit ( )

Use to release and close all used ressources.

This method will close all used ressources and restore default log behaviour.

◆ getLibraryVersion()

const QVersionNumber & QLogger::QLoggerFactory::getLibraryVersion ( )
static

Retrieve library semantic version at runtime.

Note
If compile time version check for library is needed, we can use macro QLOGGER_VERSION_ENCODE (defined inside qloggerglobal.h file)
Returns
Return constant reference to semantic version of the library

◆ initLoggerDaily()

void QLogger::QLoggerFactory::initLoggerDaily ( const QFileInfo & file,
const QTime & time,
uint maxFiles,
bool enableConsole )

Use to configure daily file log sink.

Parameters
[in]filePath of log file to use.
Examples:
  • customlog.txt: Will create log messages in current directory and use customlog as pattern to use for the rotation
  • logs/customlog.txt: Will create custom log messages in logs directory and use customlog as pattern to use for the rotation
[in]timeDaily time to use to perform rotation.
[in]maxFilesNumber of maximum log files in the directory allowing to manage memory used if needed.
Use value 0 to disable limit of files.
[in]enableConsoleSet to true to enable console/terminal printing (helpful during development, useless in release mode)
Note
If any sinks already exist, it will be properly deleted.
See also
desinit()
initLoggerRotating()

◆ initLoggerRotating()

void QLogger::QLoggerFactory::initLoggerRotating ( const QFileInfo & file,
int maxFiles,
qint64 maxSize,
bool enableConsole )

Use to configure rotating file log sink.

Parameters
[in]filePath of log file to use.
Examples:
  • customlog.txt: Will create log messages in current directory and use customlog as pattern to use for the rotation
  • logs/customlog.txt: Will create custom log messages in logs directory and use customlog as pattern to use for the rotation
[in]maxFilesNumber of files to use for rotation.
For example, if set to 3, no more than 3 files will be used for rotation.
[in]maxFileSizeMaximum log file size in bytes.
[in]enableConsoleSet to true to enable console/terminal printing (helpful during development, useless in release mode)
Note
If any sinks already exist, it will be properly deleted.
See also
desinit()
initLoggerDaily()

◆ instance()

QLoggerFactory & QLogger::QLoggerFactory::instance ( )
static

Use to get current unique instance of QLoggerFactory.

Returns
Return current unique instance of QLoggerFactory

◆ setLevel()

void QLogger::QLoggerFactory::setLevel ( QtMsgType idType)

Use to set minimum log level to use.

Please refer to BaseLogger::setLevel for more details

Parameters
[in]idTypeMinimum log level to use

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