olp-cpp-sdk  1.22.0
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:
Inheritance graph
[legend]
Collaboration diagram for olp::logging::FileAppender:
Collaboration graph
[legend]

Public Member Functions

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

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: