OSTC Companion  3.0
Companion sofftware for H&W dive computers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
LogAppender Class Referenceabstract

#include <LogAppender.h>

Inheritance diagram for LogAppender:
Inheritance graph
[legend]

Public Member Functions

 LogAppender (int argc, char *argv[])
 
virtual ~LogAppender ()
 
void setMinLevel (Log::Level level)
 
void setFormat (const char *format)
 

Static Public Member Functions

static void all (const Log &log)
 Send a message to all existing appenders. More...
 

Protected Member Functions

virtual const char * type () const =0
 Default formating string for that appender. More...
 
virtual const char * defaultFormat () const =0
 
virtual Log::Level defaultMinLevel () const =0
 
QString format (const Log &log) const
 

Protected Attributes

QByteArray _format
 How to dislay logged data ? More...
 
Log::Level _minLevel
 

Friends

void Log::close ()
 Log::close() needs an access to the list, to remove all appenders. More...
 

Constructor & Destructor Documentation

LogAppender::LogAppender ( int  argc,
char *  argv[] 
)
LogAppender::~LogAppender ( )
virtual

Member Function Documentation

void LogAppender::all ( const Log log)
static

Send a message to all existing appenders.

virtual const char* LogAppender::defaultFormat ( ) const
protectedpure virtual

Implemented in LogFile, and LogConsole.

virtual Log::Level LogAppender::defaultMinLevel ( ) const
protectedpure virtual

Implemented in LogFile, and LogConsole.

QString LogAppender::format ( const Log log) const
protected

Do the substtutions Use the string set by setFormat() to format the log event.

void LogAppender::setFormat ( const char *  format)

Set current formating.

How to format log line once appended. Default depends of the appender used (

See also
defaultFormat()). Setting a null string returns to the appender's default.

Valide substitutions are:

  • o : log level (one of DEBUG, TRACE, INFO, THROW, WARNING, ERROR).
  • d : log's date.
  • t : log's time.
  • f : source file where the error is logged (just trailling filename)
  • F : source file where the error is logged (full path)
  • l : source line where the error is logged.
  • p : the function that fired the log message.
  • m : the log message itself.

Typical usage:

LogAppenderMemory mem(0,0);
mem.setFormat("[%o] %f:%l %m");
...
LOG_TRACE("Here");
void LogAppender::setMinLevel ( Log::Level  level)

Filter messages by error level. Sets the minimum level to use for this appender. level is one of:

  • Log::LEVEL_DEBUG : The most verbose one, used only during debug session.
  • Log::LEVEL_TRACE : Messages to be put in silent log files, for post-mortem analysis.
  • Log::LEVEL_INFO : General information send to the final user.
  • Log::LEVEL_WARNING : Error reported to the user (eg. with a Qt warning box.
    See also
    LogAppenderWindow).
  • Log::LEVEL_THROW : Error that is mean to be catched, and corrected automatically.
  • Log::LEVEL_ERROR : Fatal error that cannot be recovered. The program should halt.

The default depends from the appender.

virtual const char* LogAppender::type ( ) const
protectedpure virtual

Default formating string for that appender.

Implemented in LogFile, and LogConsole.

Friends And Related Function Documentation

void Log::close ( )
friend

Log::close() needs an access to the list, to remove all appenders.

Member Data Documentation

QByteArray LogAppender::_format
protected

How to dislay logged data ?

Log::Level LogAppender::_minLevel
protected

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