olp-cpp-sdk 1.25.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olp::logging::FileAppender Class Reference

An appender that prints messages to a file. More...

#include <FileAppender.h>

Inheritance diagram for olp::logging::FileAppender:
olp::logging::IAppender

Public Member Functions

 FileAppender (const std::string &fileName, bool append=false, MessageFormatter formatter=MessageFormatter::createDefault())
 Creates a FileAppender instance.
 
bool isValid () const
 Checks whether the stream is open and can be written to.
 
const std::string & getFileName () const
 Gets the name of the file.
 
bool getAppendFile () const
 Checks whether the file has the appender.
 
const MessageFormatter & getMessageFormatter () const
 Gets the message formatter.
 
FileAppender & setMessageFormatter (MessageFormatter formatter)
 Sets the message formatter.
 
IAppender & append (const LogMessage &message) override
 Appends the message using char strings.
 

Detailed Description

An appender that prints messages to a file.

Constructor & Destructor Documentation

◆ FileAppender()

olp::logging::FileAppender::FileAppender ( const std::string &  fileName,
bool  append = false,
MessageFormatter  formatter = MessageFormatter::createDefault() 
)
explicit

Creates a FileAppender instance.

Parameters
fileNameThe name of the file to write to.
appendTrue to append to an existing file; false otherwise.
formatterThe message formatter.

Member Function Documentation

◆ append()

IAppender & olp::logging::FileAppender::append ( const LogMessage &  message)
overridevirtual

Appends the message using char strings.

Parameters
messageThe message to append.

Implements olp::logging::IAppender.

◆ getAppendFile()

bool olp::logging::FileAppender::getAppendFile ( ) const
inline

Checks whether the file has the appender.

Returns
True if the file has the appender; false otherwise.

◆ getFileName()

const std::string & olp::logging::FileAppender::getFileName ( ) const
inline

Gets the name of the file.

Returns
The file name.

◆ getMessageFormatter()

const MessageFormatter & olp::logging::FileAppender::getMessageFormatter ( ) const
inline

Gets the message formatter.

Returns
The message formatter.

◆ isValid()

bool olp::logging::FileAppender::isValid ( ) const

Checks whether the stream is open and can be written to.

Returns
True if the stream is open and can be written to; false otherwise.

◆ setMessageFormatter()

FileAppender & olp::logging::FileAppender::setMessageFormatter ( MessageFormatter  formatter)
inline

Sets the message formatter.

Parameters
formatterThe message formatter.

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