Gazebo Common

API Reference

3.17.1
FileLogger Class Reference

A logger that outputs messages to a file. More...

#include <Console.hh>

Classes

class  Buffer
 String buffer for the file logger. More...
 

Public Member Functions

 FileLogger (const std::string &_filename="")
 Constructor. More...
 
virtual ~FileLogger ()
 Destructor. More...
 
void Close ()
 Close the open file handles. More...
 
void Init (const std::string &_directory, const std::string &_filename)
 Initialize the file logger. More...
 
std::string LogDirectory () const
 Get the full path of the directory where all the log files are stored. More...
 
virtual FileLogger & operator() ()
 Output a filename and line number, then return a reference to the logger. More...
 
virtual FileLogger & operator() (const std::string &_file, int _line)
 Output a filename and line number, then return a reference to the logger. More...
 
- Public Member Functions inherited from ostream
T ostream (T... args)
 
T ~ostream (T... args)
 
T bad (T... args)
 
T clear (T... args)
 
T copyfmt (T... args)
 
T eof (T... args)
 
T exceptions (T... args)
 
T fail (T... args)
 
T fill (T... args)
 
T flags (T... args)
 
T flush (T... args)
 
T getloc (T... args)
 
T good (T... args)
 
T imbue (T... args)
 
T init (T... args)
 
T iword (T... args)
 
T move (T... args)
 
T narrow (T... args)
 
T operator bool (T... args)
 
T operator! (T... args)
 
T operator<< (T... args)
 
T precision (T... args)
 
T put (T... args)
 
T pword (T... args)
 
T rdbuf (T... args)
 
T rdstate (T... args)
 
T register_callback (T... args)
 
T seekp (T... args)
 
T set_rdbuf (T... args)
 
T setf (T... args)
 
T setstate (T... args)
 
T swap (T... args)
 
T sync_with_stdio (T... args)
 
T tellp (T... args)
 
T tie (T... args)
 
T unsetf (T... args)
 
T widen (T... args)
 
T width (T... args)
 
T write (T... args)
 
T xalloc (T... args)
 

Detailed Description

A logger that outputs messages to a file.

Constructor & Destructor Documentation

◆ FileLogger()

FileLogger ( const std::string &  _filename = "")
explicit

Constructor.

Parameters
[in]_filenameFilename to write into. If empty, FileLogger::Init must be called separately.

◆ ~FileLogger()

virtual ~FileLogger ( )
virtual

Destructor.

Member Function Documentation

◆ Close()

void Close ( )

Close the open file handles.

◆ Init()

void Init ( const std::string &  _directory,
const std::string &  _filename 
)

Initialize the file logger.

Parameters
[in]_directoryName of directory that holds the log file.
[in]_filenameName of the log file to write output into.

◆ LogDirectory()

std::string LogDirectory ( ) const

Get the full path of the directory where all the log files are stored.

Returns
Full path of the directory.

◆ operator()() [1/2]

virtual FileLogger& operator() ( )
virtual

Output a filename and line number, then return a reference to the logger.

Returns
Reference to this logger.

◆ operator()() [2/2]

virtual FileLogger& operator() ( const std::string &  _file,
int  _line 
)
virtual

Output a filename and line number, then return a reference to the logger.

Parameters
[in]_fileFilename to output.
[in]_lineLine number in the _file.
Returns
Reference to this logger.

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