libqi-api  2.0.6.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
qi::log::HeadFileLogHandler Class Reference

Log the first length lines to a file. More...

#include <headfileloghandler.hpp>

List of all members.

Public Member Functions

 HeadFileLogHandler (const std::string &filePath, int length=2000)
 Initialize the head file handler on the file. File is opened directly on construction.
virtual ~HeadFileLogHandler ()
 Closes the file.
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 if it is part of the first length lines.

Detailed Description

Log the first length lines to a file.

This class writes the logs to a file, providing they are part of the first ``length`` lines.

Definition at line 20 of file headfileloghandler.hpp.


Constructor & Destructor Documentation

qi::log::HeadFileLogHandler::HeadFileLogHandler ( const std::string &  filePath,
int  length = 2000 
)

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

Parameters:
filePathpath to the file.
lengthnumber of messages that will be written to the file.
 * .. warning::
 *
 *      If the file could not be open, it logs a warning and every log call
 *      will fail silently.
 * 

Closes the file.


Member Function Documentation

qi::log::HeadFileLogHandler::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 if it is part of the first length lines.

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 open, this function will fail silently, otherwise it will directly write the log message to the file and flush its output.

When ``length`` messages will be written to the file, it will discard all messages.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines