Gazebo Common

API Reference

5.7.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)
 
- Public Member Functions inherited from basic_ostream< char >
basic_ostream (T... args)
 
~basic_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)
 
- Public Member Functions inherited from basic_ios< char >
basic_ios (T... args)
 
~basic_ios (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)
 
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)
 
precision (T... args)
 
pword (T... args)
 
rdbuf (T... args)
 
rdstate (T... args)
 
register_callback (T... args)
 
set_rdbuf (T... args)
 
setf (T... args)
 
setstate (T... args)
 
swap (T... args)
 
sync_with_stdio (T... args)
 
tie (T... args)
 
unsetf (T... args)
 
widen (T... args)
 
width (T... args)
 
xalloc (T... args)
 
- Public Member Functions inherited from ios_base
ios_base (T... args)
 
~ios_base (T... args)
 
flags (T... args)
 
getloc (T... args)
 
imbue (T... args)
 
iword (T... args)
 
precision (T... args)
 
pword (T... args)
 
register_callback (T... args)
 
setf (T... args)
 
sync_with_stdio (T... args)
 
unsetf (T... args)
 
width (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: