CppLogging  1.0.4.0
C++ Logging Library
Public Member Functions | List of all members
CppLogging::FileAppender Class Reference

File appender. More...

#include <file_appender.h>

Inheritance diagram for CppLogging::FileAppender:
CppLogging::Appender CppLogging::Element

Public Member Functions

 FileAppender (const CppCommon::Path &file, bool truncate=false, bool auto_flush=false, bool auto_start=true)
 Initialize the appender with a given file, truncate/append and auto-flush flags. More...
 
 FileAppender (const FileAppender &)=delete
 
 FileAppender (FileAppender &&)=delete
 
virtual ~FileAppender ()
 
FileAppenderoperator= (const FileAppender &)=delete
 
FileAppenderoperator= (FileAppender &&)=delete
 
bool IsStarted () const noexcept override
 Is the logging element started? More...
 
bool Start () override
 Start the logging element. More...
 
bool Stop () override
 Stop the logging element. More...
 
void AppendRecord (Record &record) override
 Append the given logging record. More...
 
void Flush () override
 Flush the logging appender. More...
 

Detailed Description

File appender.

File appender writes the given logging record into the file with the given file name. In case of any IO error this appender will lost the logging record, but try to recover from fail in a short interval of 100ms.

Not thread-safe.

Definition at line 29 of file file_appender.h.

Constructor & Destructor Documentation

◆ FileAppender() [1/3]

CppLogging::FileAppender::FileAppender ( const CppCommon::Path &  file,
bool  truncate = false,
bool  auto_flush = false,
bool  auto_start = true 
)
explicit

Initialize the appender with a given file, truncate/append and auto-flush flags.

Parameters
file- Logging file
truncate- Truncate flag (default is false)
auto_flush- Auto-flush flag (default is false)
auto_start- Auto-start flag (default is true)

Definition at line 13 of file file_appender.cpp.

◆ FileAppender() [2/3]

CppLogging::FileAppender::FileAppender ( const FileAppender )
delete

◆ FileAppender() [3/3]

CppLogging::FileAppender::FileAppender ( FileAppender &&  )
delete

◆ ~FileAppender()

CppLogging::FileAppender::~FileAppender ( )
virtual

Definition at line 21 of file file_appender.cpp.

Member Function Documentation

◆ AppendRecord()

void CppLogging::FileAppender::AppendRecord ( Record record)
overridevirtual

Append the given logging record.

Parameters
record- Logging record

Implements CppLogging::Appender.

Definition at line 48 of file file_appender.cpp.

◆ Flush()

void CppLogging::FileAppender::Flush ( )
overridevirtual

Flush the logging appender.

Reimplemented from CppLogging::Appender.

Definition at line 73 of file file_appender.cpp.

◆ IsStarted()

bool CppLogging::FileAppender::IsStarted ( ) const
inlineoverridevirtualnoexcept

Is the logging element started?

Reimplemented from CppLogging::Element.

Definition at line 48 of file file_appender.h.

◆ operator=() [1/2]

FileAppender& CppLogging::FileAppender::operator= ( const FileAppender )
delete

◆ operator=() [2/2]

FileAppender& CppLogging::FileAppender::operator= ( FileAppender &&  )
delete

◆ Start()

bool CppLogging::FileAppender::Start ( )
overridevirtual

Start the logging element.

Returns
'true' if the logging element was successfully started, 'false' if the logging element failed to start

Reimplemented from CppLogging::Element.

Definition at line 28 of file file_appender.cpp.

◆ Stop()

bool CppLogging::FileAppender::Stop ( )
overridevirtual

Stop the logging element.

Returns
'true' if the logging element was successfully stopped, 'false' if the logging element failed to stop

Reimplemented from CppLogging::Element.

Definition at line 38 of file file_appender.cpp.


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