Geogram  Version 1.9.0
A programming library of geometric algorithms
GEO::FileLogger Class Reference

Logger client that redirects messages to a file. More...

#include <geogram/basic/logger.h>

Inheritance diagram for GEO::FileLogger:
GEO::LoggerClient GEO::Counted

Public Member Functions

 FileLogger ()
 Creates an empty file logger. More...
 
 FileLogger (const std::string &file_name)
 Creates logger that logs messages to a file. More...
 
void div (const std::string &title) override
 Creates a new division. More...
 
void out (const std::string &str) override
 Handles an information message. More...
 
void warn (const std::string &str) override
 Handles a warning message. More...
 
void err (const std::string &str) override
 Handles an error message. More...
 
void status (const std::string &str) override
 Handles a status message. More...
 
- Public Member Functions inherited from GEO::LoggerClient
 ~LoggerClient () override
 LoggerClient destructor.
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Protected Member Functions

 ~FileLogger () override
 FileLogger destructor.
 
void set_file_name (const std::string &file_name)
 Sets the log file name. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Detailed Description

Logger client that redirects messages to a file.

Definition at line 248 of file logger.h.

Constructor & Destructor Documentation

◆ FileLogger() [1/2]

GEO::FileLogger::FileLogger ( )

Creates an empty file logger.

The default constructed file logger does not handle messages until it is set a filename with set_file_name()

◆ FileLogger() [2/2]

GEO::FileLogger::FileLogger ( const std::string &  file_name)

Creates logger that logs messages to a file.

All sent to the file logger are sent to the file file_name.

Parameters
[in]file_namename of the log file

Member Function Documentation

◆ div()

void GEO::FileLogger::div ( const std::string &  title)
overridevirtual

Creates a new division.

This creates a new division entitled with title

Parameters
[in]titlethe text of the title

Implements GEO::LoggerClient.

◆ err()

void GEO::FileLogger::err ( const std::string &  str)
overridevirtual

Handles an error message.

Parameters
[in]strthe text of the message

Implements GEO::LoggerClient.

◆ out()

void GEO::FileLogger::out ( const std::string &  str)
overridevirtual

Handles an information message.

Parameters
[in]strthe text of the message

Implements GEO::LoggerClient.

◆ set_file_name()

void GEO::FileLogger::set_file_name ( const std::string &  file_name)
protected

Sets the log file name.

If the client already had a file name, the corresponding file stream is closed and reopened with file_name.

Parameters
[in]file_namethe name of the log file

◆ status()

void GEO::FileLogger::status ( const std::string &  str)
overridevirtual

Handles a status message.

Parameters
[in]strthe text of the message This function does actually nothing

Implements GEO::LoggerClient.

◆ warn()

void GEO::FileLogger::warn ( const std::string &  str)
overridevirtual

Handles a warning message.

Parameters
[in]strthe text of the message

Implements GEO::LoggerClient.


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