AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
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, unsigned 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() [1/2]

anch::logger::Writer::Writer ( const std::string & fileName,
const std::string & linePattern,
unsigned 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() [2/2]

anch::logger::Writer::Writer ( std::ostream * output,
const std::string & linePattern )

Writer constructor

Parameters
outputThe output to use
linePatternThe line pattern

◆ ~Writer()

virtual anch::logger::Writer::~Writer ( )
virtual

Writer destructor

Member Function Documentation

◆ rotate()

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

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

Returns
true or false

◆ rotateFiles()

void anch::logger::Writer::rotateFiles ( )
protected

Rotate files when current reachs the maximum file length.

◆ write()

virtual void anch::logger::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

◆ _formatter

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

Message formatter

◆ _output

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

Ouput file stream


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