libqi-api  2.1.4.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
qi::log::FileLogHandler Class Reference

Log messages to a file. More...

#include <fileloghandler.hpp>

Public Member Functions

 FileLogHandler (const std::string &filePath)
 Initialize the file handler on the file. File is opened directly on construction. More...
 
virtual ~FileLogHandler ()
 Closes the file. More...
 
void log (const qi::LogLevel verb, const qi::os::timeval date, const char *category, const char *msg, const char *file, const char *fct, const int line)
 Writes a log message to the file. More...
 

Detailed Description

Log messages to a file.

This class writes all logs to a file.

Definition at line 19 of file fileloghandler.hpp.

Constructor & Destructor Documentation

qi::log::FileLogHandler::FileLogHandler ( const std::string &  filePath)
explicit

Initialize the file handler on the file. File is opened directly on construction.

Parameters
filePaththe path to the file where log messages will be written.
* .. warning::
*
*      If the file could not be opened, it logs a warning and every log call
*      will silently fail.
* 
virtual qi::log::FileLogHandler::~FileLogHandler ( )
virtual

Closes the file.

Member Function Documentation

qi::log::FileLogHandler::log ( const qi::LogLevel  verb,
const qi::os::timeval  date,
const char *  category,
const char *  msg,
const char *  file,
const char *  fct,
const int  line 
)

Writes a log message to the file.

Parameters
verbverbosity of the log message.
datedate at which the log message was issued.
categorywill be used in future for filtering
msgactual message to log.
filefilename from which this log message was issued.
fctfunction name from which this log message was issued.
lineline number in the issuer file.

If the file could not be opened, this function will silently fail, otherwise it will directly write the log message to the file and flush its output.


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