TreeFrogFramework 2.10
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TLogger Class Referenceabstract

#include <tlogger.h>

Inheritance diagram for TLogger:
Inheritance graph
[legend]

Public Member Functions

 TLogger ()
 
virtual ~TLogger ()
 
virtual QString key () const =0
 
virtual bool isMultiProcessSafe () const =0
 
virtual bool open ()=0
 
virtual void close ()=0
 
virtual bool isOpen () const =0
 
virtual void log (const QByteArray &)=0
 
virtual void log (const TLog &tlog)
 
virtual void flush ()
 
virtual QByteArray logToByteArray (const TLog &log) const
 
const QByteArray & layout () const
 
const QByteArray & dateTimeFormat () const
 
Tf::LogPriority threshold () const
 
const QString & target () const
 

Static Public Member Functions

static QByteArray logToByteArray (const TLog &log, const QByteArray &layout, const QByteArray &dateTimeFormat, QStringConverter::Encoding encoding=QStringConverter::Utf8)
 
static QByteArray priorityToString (Tf::LogPriority priority)
 

Protected Member Functions

QStringConverter::Encoding encoding () const
 
QVariant settingsValue (const QString &key, const QVariant &defaultValue=QVariant()) const
 

Detailed Description

The TLogger class provides an abstract base of logging functionality.

Constructor & Destructor Documentation

◆ TLogger()

TLogger::TLogger ( )

Constructor.

◆ ~TLogger()

virtual TLogger::~TLogger ( )
inlinevirtual

Member Function Documentation

◆ close()

void TLogger::close ( )
pure virtual

Closes the device.

This function should be called from any reimplementations of close().

Implemented in TStdOutLogger.

◆ dateTimeFormat()

const QByteArray & TLogger::dateTimeFormat ( ) const

Returns a reference to the value for the setting datetime format.

◆ encoding()

QStringConverter::Encoding TLogger::encoding ( ) const
protected

Returns the default text encoding.

◆ flush()

void TLogger::flush ( )
inlinevirtual

Flushes any buffered data to the device.

This function should be called from any reimplementations of flush().

Reimplemented in TStdOutLogger.

◆ isMultiProcessSafe()

bool TLogger::isMultiProcessSafe ( ) const
pure virtual

Returns true if the implementation is guaranteed to be free of race conditions when accessed by multiple processes simultaneously; otherwise returns false.

Implemented in TStdOutLogger.

◆ isOpen()

bool TLogger::isOpen ( ) const
pure virtual

Returns true if the device is open; otherwise returns false.

This function should be called from any reimplementations of isOpen().

Implemented in TStdOutLogger.

◆ key()

QString TLogger::key ( ) const
pure virtual

Returns a key that this logger plugin supports.

Implemented in TStdOutLogger.

◆ layout()

const QByteArray & TLogger::layout ( ) const

Returns a reference to the value for the setting layout.

◆ log() [1/2]

virtual void TLogger::log ( const QByteArray &  )
pure virtual

Implemented in TStdOutLogger.

◆ log() [2/2]

void TLogger::log ( const TLog log)
inlinevirtual

Writes the log log to the device.

This function should be called from any reimplementations of log().

◆ logToByteArray() [1/2]

QByteArray TLogger::logToByteArray ( const TLog log) const
virtual

Converts the log log to its textual representation and returns a QByteArray containing the data.

◆ logToByteArray() [2/2]

QByteArray TLogger::logToByteArray ( const TLog log,
const QByteArray &  layout,
const QByteArray &  dateTimeFormat,
QStringConverter::Encoding  encoding = QStringConverter::Utf8 
)
static

Converts the log log to its textual representation and returns a QByteArray containing the data.

◆ open()

bool TLogger::open ( )
pure virtual

Opens the device for logging.

Returns true if successful; otherwise returns false. This function should be called from any reimplementations of open().

Implemented in TStdOutLogger.

◆ priorityToString()

QByteArray TLogger::priorityToString ( Tf::LogPriority  priority)
static

Returns a QByteArray containing the priority priority.

◆ settingsValue()

QVariant TLogger::settingsValue ( const QString &  k,
const QVariant &  defaultValue = QVariant() 
) const
protected

Returns the value for logger setting key.

If the setting doesn't exist, returns defaultValue.

◆ target()

const QString & TLogger::target ( ) const

Returns a reference to the value for the setting target device.

◆ threshold()

Tf::LogPriority TLogger::threshold ( ) const

Returns the value for the setting priority threshold.


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