Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
LoggerFacade Class Reference

The LoggerFacade class is just a facade for the specified application logging engine. More...

#include <LoggerFacade.h>

Inherited by NullLogger, and TextLogger.

Public Member Functions

 LoggerFacade (const QString &name)
 
virtual void d (const QString &message)
 
virtual void e (const QString &message)
 
virtual void f (const QString &message)
 
virtual LoggerFacadegetLogger (const QString &name)
 
virtual void i (const QString &message)
 
const QStringname () const
 
virtual void t (const QString &message)
 
virtual void w (const QString &message)
 

Static Public Member Functions

static LoggerFacade createLogger (const QString &name)
 
static void installLoggerEngine (LoggerFacade *loggerEngine)
 
static LoggerFacadeloggerEngine ()
 

Protected Member Functions

 LoggerFacade (LoggerFacade *engine)
 

Detailed Description

The LoggerFacade class is just a facade for the specified application logging engine.

This class provides a well-known interface and used at least by the carousel library and its components. It is strongly recomended to create your own logger facade over some better logging engine (e.g., log4cplus).

The order in terms of verbosity, from least to most is Fatal, Error, Warning, Info, Debug, Trace. Trace should never be compiled into an application except during development. Debug logs are compiled in but should be stripped at runtime (in your logging engine). Fatal, error, warning and info logs are always kept.

There is a predefined simple logger - TextLogger which is created by the BootloaderBase during the loading sequence by default, so you can access pointer to LoggerFacade instance through the loggerEngine():

*

To instantiate your own logger facade to the application logging engine you have to override BootloaderBase::createLoggerEngine() method in your own bootloader, that returns pointer to the LoggerFacade.

Constructor & Destructor Documentation

LoggerFacade::LoggerFacade ( const QString name)

Initializes a new instance of the LoggerFacade class using specified logger name.

LoggerFacade::LoggerFacade ( LoggerFacade engine)
protected

Initializes a new instance of the LoggerFacade class using specified logger engine and empty name.

Member Function Documentation

static LoggerFacade LoggerFacade::createLogger ( const QString name)
static

Creates a logger using installed logger engine.

You should use it every time when you want to get a logger:

* LoggerFacade Log = LoggerFacade::createLogger("MyLoggerName");
*
static LoggerFacade* LoggerFacade::loggerEngine ( )
static

Gets an installed logger engine.

Usually you do not use it. Use LoggerFacade::createLogger() instead.

static void LoggerFacade::installLoggerEngine ( LoggerFacade loggerEngine)
static

Installs a logger engine which will be used at least by carousel libraries and its components.

Logger engine is installed by the BootloaderBase during the loading sequence. By default TextLogger is installed, but it is strongly recomended to use some robust logging engine (e.g. log4cplus). To do it you should override BootloaderBase::createLoggerEngine() method in your own bootloader and return pointer to the new logging engine facade.

virtual LoggerFacade* LoggerFacade::getLogger ( const QString name)
virtual

Retrieves a logger with name name.

Depends on installed logging engine it can return named logger if it already exists, or create a new instance, otherwise.

Default implementation just returns already created instance regardless of the name.

Reimplemented in TextLogger, and NullLogger.

virtual void LoggerFacade::d ( const QString message)
virtual

Sends a debug log message. Default implementation does nothing.

Reimplemented in TextLogger, and NullLogger.

virtual void LoggerFacade::e ( const QString message)
virtual

Sends an error log message. Default implementation does nothing.

Reimplemented in TextLogger, and NullLogger.

virtual void LoggerFacade::f ( const QString message)
virtual

Sends a fatal log message. Default implementation does nothing.

Reimplemented in TextLogger, and NullLogger.

virtual void LoggerFacade::i ( const QString message)
virtual

Sends an info log message. Default implementation does nothing.

Reimplemented in TextLogger, and NullLogger.

virtual void LoggerFacade::t ( const QString message)
virtual

Sends a trace log message. Default implementation does nothing.

Reimplemented in TextLogger, and NullLogger.

virtual void LoggerFacade::w ( const QString message)
virtual

Sends a warning log message. Default implementation does nothing.

Reimplemented in TextLogger, and NullLogger.

const QString& LoggerFacade::name ( ) const

The name which will append in the log message to the output stream.