Log4Qt::WriterAppender Class Reference

The class WriterAppender appends log events to a QTextStream. More...

#include <writerappender.h>

Inheritance diagram for Log4Qt::WriterAppender:

Log4Qt::AppenderSkeleton Log4Qt::Appender Log4Qt::LogObject Log4Qt::ConsoleAppender Log4Qt::FileAppender Log4Qt::DailyRollingFileAppender Log4Qt::RollingFileAppender

List of all members.

Public Member Functions

 WriterAppender (QObject *pParent=0)
 WriterAppender (Layout *pLayout, QObject *pParent=0)
 WriterAppender (Layout *pLayout, QTextStream *pTextStream, QObject *pParent=0)
virtual ~WriterAppender ()
virtual bool requiresLayout () const
QTextCodec * encoding () const
bool immediateFlush () const
QTextStream * writer () const
void setEncoding (QTextCodec *pTextCodec)
void setImmediateFlush (bool immediateFlush)
void setWriter (QTextStream *pTextStream)
virtual void activateOptions ()
virtual void close ()

Protected Member Functions

virtual void append (const LoggingEvent &rEvent)
virtual bool checkEntryConditions () const
void closeWriter ()
virtual QDebug debug (QDebug &rDebug) const
virtual bool handleIoErrors () const
void writeFooter () const
void writeHeader () const

Properties

QTextCodec encoding
QTextStream writer
bool immediateFlush


Detailed Description

The class WriterAppender appends log events to a QTextStream.

Note:
All the functions declared in this class are thread-safe.  

The ownership and lifetime of objects of this class are managed. See Object ownership for more details.


Constructor & Destructor Documentation

Log4Qt::WriterAppender::WriterAppender ( QObject *  pParent = 0  ) 

Log4Qt::WriterAppender::WriterAppender ( Layout pLayout,
QObject *  pParent = 0 
)

Log4Qt::WriterAppender::WriterAppender ( Layout pLayout,
QTextStream *  pTextStream,
QObject *  pParent = 0 
)

virtual Log4Qt::WriterAppender::~WriterAppender (  )  [virtual]


Member Function Documentation

virtual bool Log4Qt::WriterAppender::requiresLayout (  )  const [virtual]

Implements Log4Qt::Appender.

QTextCodec* Log4Qt::WriterAppender::encoding (  )  const

bool Log4Qt::WriterAppender::immediateFlush (  )  const

QTextStream* Log4Qt::WriterAppender::writer (  )  const

void Log4Qt::WriterAppender::setEncoding ( QTextCodec *  pTextCodec  ) 

Sets the codec used by the writer to pTextCoded.

If a codec is set with setEncoding, it will overwrite the codec set in the text stream. A subsequent call with pTextCoded equals null will resets the codec to the default QTextCodec::codecForLocale().

See also:
encoding(), QTextSream::setCodec(), QTextCodec::codecForLocale()

void Log4Qt::WriterAppender::setImmediateFlush ( bool  immediateFlush  )  [inline]

void Log4Qt::WriterAppender::setWriter ( QTextStream *  pTextStream  ) 

virtual void Log4Qt::WriterAppender::activateOptions (  )  [virtual]

virtual void Log4Qt::WriterAppender::close (  )  [virtual]

Reimplemented from Log4Qt::AppenderSkeleton.

Reimplemented in Log4Qt::ConsoleAppender, and Log4Qt::FileAppender.

virtual void Log4Qt::WriterAppender::append ( const LoggingEvent rEvent  )  [protected, virtual]

virtual bool Log4Qt::WriterAppender::checkEntryConditions (  )  const [protected, virtual]

Tests if all entry conditions for using append() in this class are met.

If a conditions is not met, an error is logged and the function returns false. Otherwise the result of AppenderSkeleton::checkEntryConditions() is returned.

The checked conditions are:

  • A writer has been set (APPENDER_USE_MISSING_WRITER_ERROR)

The function is called as part of the checkEntryConditions() chain started by AppenderSkeleton::doAppend().

See also:
AppenderSkeleton::doAppend(), AppenderSkeleton::checkEntryConditions()

Reimplemented from Log4Qt::AppenderSkeleton.

Reimplemented in Log4Qt::DailyRollingFileAppender, and Log4Qt::FileAppender.

void Log4Qt::WriterAppender::closeWriter (  )  [protected]

virtual QDebug Log4Qt::WriterAppender::debug ( QDebug &  rDebug  )  const [protected, virtual]

Writes all object member variables to the given debug stream rDebug and returns the stream.

WriterAppender(name:"WA" encoding:"" immediateFlush:true isactive:false isclosed:false layout:"TTCC" referencecount:1 threshold:"NULL" writer:0x0)

See also:
QDebug, operator<<(QDebug debug, const LogObject &rLogObject )

Implements Log4Qt::LogObject.

Reimplemented in Log4Qt::ConsoleAppender, Log4Qt::DailyRollingFileAppender, Log4Qt::FileAppender, and Log4Qt::RollingFileAppender.

virtual bool Log4Qt::WriterAppender::handleIoErrors (  )  const [protected, virtual]

Reimplemented in Log4Qt::FileAppender.

void Log4Qt::WriterAppender::writeFooter (  )  const [protected]

void Log4Qt::WriterAppender::writeHeader (  )  const [protected]


Property Documentation

QTextCodec * Log4Qt::WriterAppender::encoding [inline, read, write]

The property holds the codec the appender uses.

The default is null to use the codec the writer has set.

See also:
encoding(), setEncoding()

QTextStream * Log4Qt::WriterAppender::writer [inline, read, write]

The property holds the writer the appender uses.

See also:
writer(), setWriter()

bool Log4Qt::WriterAppender::immediateFlush [inline, read, write]

The property holds, if the writer flushes after all write operations.

The default is true for flushing.

See also:
immediateFlush(), setImmediateFlush()


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

Generated on Sun Mar 1 16:40:46 2009 for Log4Qt by  doxygen 1.5.6