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

Vincent Lachenal

Constructor & Destructor Documentation

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

Writer constructor

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

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

Writer destructor

Member Function Documentation

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

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

true or false
void Writer::rotateFiles ( )

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 

Write message in the file

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

Message formatter

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

Ouput file stream

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