Gazebo Common

API Reference

3.17.0
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 FileLoggeroperator() ()
 Output a filename and line number, then return a reference to the logger. More...
 
virtual FileLoggeroperator() (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
ostream (T... args)
 
~ostream (T... args)
 
bad (T... args)
 
clear (T... args)
 
copyfmt (T... args)
 
eof (T... args)
 
exceptions (T... args)
 
fail (T... args)
 
fill (T... args)
 
flags (T... args)
 
flush (T... args)
 
getloc (T... args)
 
good (T... args)
 
imbue (T... args)
 
init (T... args)
 
iword (T... args)
 
move (T... args)
 
narrow (T... args)
 
operator bool (T... args)
 
operator! (T... args)
 
operator<< (T... args)
 
precision (T... args)
 
put (T... args)
 
pword (T... args)
 
rdbuf (T... args)
 
rdstate (T... args)
 
register_callback (T... args)
 
seekp (T... args)
 
set_rdbuf (T... args)
 
setf (T... args)
 
setstate (T... args)
 
swap (T... args)
 
sync_with_stdio (T... args)
 
tellp (T... args)
 
tie (T... args)
 
unsetf (T... args)
 
widen (T... args)
 
width (T... args)
 
write (T... args)
 
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: