AnCH Framework  0.1
Another C++ Hack Framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
anch::logger::Writer Class Reference

#include <writer.hpp>

Inheritance diagram for anch::logger::Writer:
Collaboration diagram for anch::logger::Writer:

Public Member Functions

 Writer (const std::string &fileName, const std::string &linePattern, int maxSize=0, int maxIndex=0)
 
 Writer (std::ostream *output, const std::string &linePattern)
 
virtual ~Writer ()
 
virtual void write (const std::string &category, const anch::logger::Level &level, const std::string &message)
 

Protected Member Functions

bool rotate () const
 
void rotateFiles ()
 

Protected Attributes

std::ostream * _output
 
anch::logger::formatter::MessageFormatter _formatter
 

Detailed Description

File writer which is not thread safe

Author
Vincent Lachenal

Constructor & Destructor Documentation

Writer::Writer ( const std::string &  fileName,
const std::string &  linePattern,
int  maxSize = 0,
int  maxIndex = 0 
)

Writer constructor

Parameters
fileNameThe file name
linePatternThe line pattern
maxSizeThe file maximum size before file rotation
maxIndexThe maximum number of log files to keep
Writer::Writer ( std::ostream *  output,
const std::string &  linePattern 
)

Writer constructor

Parameters
outputThe output to use
linePatternThe line pattern
Writer::~Writer ( )
virtual

Writer destructor

Member Function Documentation

bool anch::logger::Writer::rotate ( ) const
inlineprotected

Check if file has to be rotate according to configuration and its size

Returns
true or false
void Writer::rotateFiles ( )
protected

Rotate files when current reachs the maximum file length.

void Writer::write ( const std::string &  category,
const anch::logger::Level level,
const std::string &  message 
)
virtual

Write message in the file

Parameters
categoryThe logger category
levelThe message level
messageMessage to write

Reimplemented in anch::logger::LowPriorityWriter, and anch::logger::ThreadSafeWriter.

Member Data Documentation

anch::logger::formatter::MessageFormatter anch::logger::Writer::_formatter
protected

Message formatter

std::ostream* anch::logger::Writer::_output
protected

Ouput file stream


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