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

The TextLogger class provides the simple logging for the carousel engine. More...

#include <TextLogger.h>

Inherits LoggerFacade.

Public Member Functions

 TextLogger (QTextStream &output)
 
 TextLogger (QTextStream &output, const QString &name)
 
void d (const QString &message)
 
void e (const QString &message)
 
void f (const QString &message)
 
LoggerFacadegetLogger (const QString &name)
 
void i (const QString &message)
 
void t (const QString &message)
 
void w (const QString &message)
 
- Public Member Functions inherited from LoggerFacade
 LoggerFacade (const QString &name)
 
const QStringname () const
 

Protected Member Functions

virtual void log (const QString &message, const QString &category)
 
- Protected Member Functions inherited from LoggerFacade
 LoggerFacade (LoggerFacade *engine)
 

Protected Attributes

QTextStreamm_outputStream
 

Additional Inherited Members

- Static Public Member Functions inherited from LoggerFacade
static LoggerFacade createLogger (const QString &name)
 
static void installLoggerEngine (LoggerFacade *loggerEngine)
 
static LoggerFacadeloggerEngine ()
 

Detailed Description

The TextLogger class provides the simple logging for the carousel engine.

Writes output to the QTextStream specified in the constructor with following pattern:

* [%1][%2] %3: %4
*

where first parameter is datetime, second logger name, third - category and fourth - message. For example:

* QTextStream out(stdout);
* TextLogger logger(out);
* logger.d("Hello, carousel!");
*

will printed to the console

* [18 Jul, 18:04:34.056][Debug] Root: Hello, carousel!
*

If you does't override BootloaderBase::createLoggerEngine() method to instantiate your own logger facade over the better logging engine (e.g., log4cplus), the default logger will be created with the std::cout stream for output during the loading sequence:

* {
* static QTextStream text(stdout);
* return new TextLogger(text);
* }
*
Note
This class is not thread-safe.

Constructor & Destructor Documentation

TextLogger::TextLogger ( QTextStream output)

Initializes a new instance of the TextLogger class with the specified output stream for the logging.

Sets logger name to Root.

TextLogger::TextLogger ( QTextStream output,
const QString name 
)

Initializes a new instance of the TextLogger class with the specified name and output stream for the logging.

The name will append in the log message.

Member Function Documentation

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

Creates and returns a new instance of the TextLogger with specified name.

Reimplemented from LoggerFacade.

void TextLogger::d ( const QString message)
virtual

Sends a debug log message to the output stream. Debug logs are stripped at runtime in release configuration.

Reimplemented from LoggerFacade.

void TextLogger::e ( const QString message)
virtual

Sends an error log message to the output stream.

Reimplemented from LoggerFacade.

void TextLogger::f ( const QString message)
virtual

Sends a fatal log message to the output stream.

Reimplemented from LoggerFacade.

void TextLogger::i ( const QString message)
virtual

Sends an info log message to the output stream.

Reimplemented from LoggerFacade.

void TextLogger::t ( const QString message)
virtual

Sends a trace log message to the output stream.

Reimplemented from LoggerFacade.

void TextLogger::w ( const QString message)
virtual

Sends a warning log message to the output stream.

Reimplemented from LoggerFacade.

Member Data Documentation

QTextStream& TextLogger::m_outputStream
protected

The specified output stream for the logging.