FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Logging::FMTLogger Class Referenceabstract

Base class handling the level of information printed by FMT. More...

#include <FMTLogger.h>

Inheritance diagram for Logging::FMTLogger:
[legend]
Collaboration diagram for Logging::FMTLogger:
[legend]

Public Member Functions

 FMTLogger ()
 Default constructor for FMTLogger.
 
virtual ~FMTLogger ()
 Default destructor for FMTLogger.
 
 FMTLogger (const FMTLogger &rhs)
 Copy constructor for FMTLogger.
 
void redirectToFile (const std::string &filename, bool logStamp=true)
 Redirect the log information to a file.
 
void closeFileStream ()
 Close the file stream.
 
FMTLoggeroperator= (const FMTLogger &rhs)
 Copy assignment operator for FMTLogger.
 
virtual int print ()
 Print function overloaded from CoinMessageHandler when using the OSI solver interface.
 
virtual void checkSeverity ()
 Check the severity of the message to be printed by the CoinMessageHandler base class.
 
virtual FMTLoggerclone () const =0
 Clone the logger, needed for the abstract CoinMessageHandler usage.
 
virtual std::string getLogStamp () const
 Return the basic log stamp as a string.
 
virtual void logStamp ()
 Log information about the version of FMT and its build date.
 
virtual void logTime ()
 Log the actual time at which the function is called.
 
void setStreamFlush (bool flush)
 Force the flushing of the file stream.
 
virtual FMTLoggeroperator<< (const std::string &msg)
 Append a string to the log.
 
virtual FMTLoggeroperator<< (const int &msg)
 Append an int to the log.
 
virtual FMTLoggeroperator<< (const double &msg)
 Append a double to the log.
 
virtual FMTLoggeroperator<< (const float &msg)
 Append a float to the log.
 
virtual FMTLoggeroperator<< (const std::time_t &msg)
 Append a std::time_t to the log.
 
virtual FMTLoggeroperator<< (const size_t &msg)
 Append a size_t to the log.
 
virtual FMTLoggeroperator<< (const unsigned int &msg)
 Append an unsigned int to the log.
 
virtual FMTLoggeroperator<< (const void *&msg)
 Append the address of a void pointer to the log.
 
virtual bool logWithLevel (const std::string &p_msg, const int &p_messageLevel) const
 Log a message with a given message level if message level is greater of equal to the logger level then it will be printed.
 
virtual FMTSolverLoggergetSolverLogger ()
 Return the abstract logger used by the OSI solver interface.
 
virtual std::unique_ptr< FMTLoggerClone () const =0
 clone the FMTLogger
 

Protected Member Functions

virtual void _cout (const char *message) const
 Output a message, sometimes needed on Windows with boost::python to print directly into the Python window.
 
virtual void _setLoggingLevel (const int &level)
 Set the solver logger logging level.
 

Protected Attributes

std::unique_ptr< FMTSolverLoggerm_solverref
 
std::string m_filepath
 string path the the potential filestream
 
std::unique_ptr< std::ofstream > m_FileStream
 stream if the logger redirect the logging into somesort of file.
 
boost::recursive_mutex m_mtx
 Mutex for multi-threading.
 
bool m_flushstream
 If true will flush stream at each write.
 

Friends

class boost::serialization::access
 

Detailed Description

Base class handling the level of information printed by FMT.

When FMT is compiled with the OSI solver interface this class derives from CoinMessageHandler to help handle the log level of the solvers.

Constructor & Destructor Documentation

◆ FMTLogger() [1/2]

Logging::FMTLogger::FMTLogger ( )

Default constructor for FMTLogger.

◆ ~FMTLogger()

virtual Logging::FMTLogger::~FMTLogger ( )
virtual

Default destructor for FMTLogger.

◆ FMTLogger() [2/2]

Logging::FMTLogger::FMTLogger ( const FMTLogger rhs)

Copy constructor for FMTLogger.

Parameters
[in]rhsthe FMTLogger to copy.

Member Function Documentation

◆ _cout()

virtual void Logging::FMTLogger::_cout ( const char *  message) const
protectedvirtual

Output a message, sometimes needed on Windows with boost::python to print directly into the Python window.

Parameters
[in]messagethe message to output.

Reimplemented in Logging::FMTExcelLogger, and Logging::FMTQuietLogger.

◆ _setLoggingLevel()

virtual void Logging::FMTLogger::_setLoggingLevel ( const int &  level)
protectedvirtual

Set the solver logger logging level.

Parameters
[in]levelthe logging level to set.

◆ checkSeverity()

virtual void Logging::FMTLogger::checkSeverity ( )
virtual

Check the severity of the message to be printed by the CoinMessageHandler base class.

Reimplemented in Logging::FMTDebugLogger, Logging::FMTDefaultLogger, Logging::FMTQuietLogger, and Logging::FMTTaskLogger.

◆ clone()

virtual FMTLogger * Logging::FMTLogger::clone ( ) const
pure virtual

Clone the logger, needed for the abstract CoinMessageHandler usage.

Returns
a pointer to the cloned logger.

Implemented in Logging::FMTExcelLogger, Logging::FMTDebugLogger, Logging::FMTDefaultLogger, Logging::FMTQuietLogger, and Logging::FMTTaskLogger.

◆ Clone()

virtual std::unique_ptr< FMTLogger > Logging::FMTLogger::Clone ( ) const
pure virtual

◆ closeFileStream()

void Logging::FMTLogger::closeFileStream ( )

Close the file stream.

◆ getLogStamp()

virtual std::string Logging::FMTLogger::getLogStamp ( ) const
virtual

Return the basic log stamp as a string.

Returns
the log stamp.

◆ getSolverLogger()

virtual FMTSolverLogger * Logging::FMTLogger::getSolverLogger ( )
virtual

Return the abstract logger used by the OSI solver interface.

Returns
a pointer to the solver logger.

◆ logStamp()

virtual void Logging::FMTLogger::logStamp ( )
virtual

Log information about the version of FMT and its build date.

◆ logTime()

virtual void Logging::FMTLogger::logTime ( )
virtual

Log the actual time at which the function is called.

◆ logWithLevel()

virtual bool Logging::FMTLogger::logWithLevel ( const std::string &  p_msg,
const int &  p_messageLevel 
) const
virtual

Log a message with a given message level if message level is greater of equal to the logger level then it will be printed.

Parameters
[in]p_msgthe message
[in]p_messageLevelmessage level
Returns
true if printed

◆ operator<<() [1/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const double &  msg)
virtual

Append a double to the log.

Parameters
[in]msgthe a double to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [2/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const float &  msg)
virtual

Append a float to the log.

Parameters
[in]msgthe a float to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [3/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const int &  msg)
virtual

Append an int to the log.

Parameters
[in]msgthe an int to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [4/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const size_t &  msg)
virtual

Append a size_t to the log.

Parameters
[in]msgthe a size_t to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [5/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const std::string &  msg)
virtual

Append a string to the log.

Parameters
[in]msgthe a string to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [6/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const std::time_t &  msg)
virtual

Append a std::time_t to the log.

Parameters
[in]msgthe a std::time_t to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [7/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const unsigned int &  msg)
virtual

Append an unsigned int to the log.

Parameters
[in]msgthe an unsigned int to append.
Returns
a reference to this FMTLogger.

◆ operator<<() [8/8]

virtual FMTLogger & Logging::FMTLogger::operator<< ( const void *&  msg)
virtual

Append the address of a void pointer to the log.

Parameters
[in]msgthe void pointer whose address is appended.
Returns
a reference to this FMTLogger.

◆ operator=()

FMTLogger & Logging::FMTLogger::operator= ( const FMTLogger rhs)

Copy assignment operator for FMTLogger.

Parameters
[in]rhsthe FMTLogger to copy.
Returns
a reference to this FMTLogger.

◆ print()

virtual int Logging::FMTLogger::print ( )
virtual

Print function overloaded from CoinMessageHandler when using the OSI solver interface.

Returns
the value returned by the print function.

Reimplemented in Logging::FMTDebugLogger, Logging::FMTDefaultLogger, Logging::FMTQuietLogger, and Logging::FMTTaskLogger.

◆ redirectToFile()

void Logging::FMTLogger::redirectToFile ( const std::string &  filename,
bool  logStamp = true 
)

Redirect the log information to a file.

Parameters
[in]filenamethe file to redirect the log to.
[in]logStampif true writes a log stamp.

◆ setStreamFlush()

void Logging::FMTLogger::setStreamFlush ( bool  flush)

Force the flushing of the file stream.

Parameters
[in]flushif true flushes the stream at each write.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ m_filepath

std::string Logging::FMTLogger::m_filepath
protected

string path the the potential filestream

◆ m_FileStream

std::unique_ptr<std::ofstream> Logging::FMTLogger::m_FileStream
mutableprotected

stream if the logger redirect the logging into somesort of file.

◆ m_flushstream

bool Logging::FMTLogger::m_flushstream
protected

If true will flush stream at each write.

◆ m_mtx

boost::recursive_mutex Logging::FMTLogger::m_mtx
mutableprotected

Mutex for multi-threading.

◆ m_solverref

std::unique_ptr<FMTSolverLogger> Logging::FMTLogger::m_solverref
protected

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