AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
anch::log::FileWriter Class Reference

Log file writer. More...

#include <fileWriter.hpp>

Inheritance diagram for anch::log::FileWriter:
Collaboration diagram for anch::log::FileWriter:

Public Member Functions

 FileWriter (const anch::conf::Section &conf)
virtual ~FileWriter ()
virtual void write (const std::string &message)
Public Member Functions inherited from anch::log::Writer
 Writer (const anch::conf::Section &conf)
virtual ~Writer ()

Protected Member Functions

bool rotate () const
void rotateFiles ()
Protected Member Functions inherited from anch::log::Writer
std::string format (const std::string &msg)

Protected Attributes

std::ofstream * _output
std::filesystem::path _path
uint32_t _maxSize
int _maxIdx
int _fileIdx

Detailed Description

Log file writer.

Manage file writer with file rotation on size, date and max rotate index

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ FileWriter()

anch::log::FileWriter::FileWriter ( const anch::conf::Section & conf)

FileWriter constructor

Parameters
confthe writer's configuration

◆ ~FileWriter()

virtual anch::log::FileWriter::~FileWriter ( )
virtual

FileWriter destructor

Member Function Documentation

◆ rotate()

bool anch::log::FileWriter::rotate ( ) const
protected

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

Returns
true or false

◆ rotateFiles()

void anch::log::FileWriter::rotateFiles ( )
protected

Rotate files when current reachs the maximum file length.

◆ write()

virtual void anch::log::FileWriter::write ( const std::string & message)
virtual

Write message in the file.
Rotate log file when needed.

Parameters
messageMessage to write

Implements anch::log::Writer.

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

Member Data Documentation

◆ _fileIdx

int anch::log::FileWriter::_fileIdx
protected

Current file index

◆ _maxIdx

int anch::log::FileWriter::_maxIdx
protected

Maximum file index

◆ _maxSize

uint32_t anch::log::FileWriter::_maxSize
protected

Maximum file size

◆ _output

std::ofstream* anch::log::FileWriter::_output
protected

Ouput file stream

◆ _path

std::filesystem::path anch::log::FileWriter::_path
protected

File name


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