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

Keeps at most 2 MiB of logs. More...

#include <tailfileloghandler.hpp>

List of all members.

Public Member Functions

 TailFileLogHandler (const std::string &filePath)
 Initialize the tail file log handler. File is opened on construction.
virtual ~TailFileLogHandler ()
 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 the log message to the file.

Detailed Description

Keeps at most 2 MiB of logs.

 * This class writes the logs to a file. When more than 1 MiB are written, it
 * moves the file to *filePath*.old, truncates *filePath*, and keeps writing
 * inside it. This means that you will get at most the last 2 MiB logged by
 * :cpp:class:`qi::log::TailFileLogHandler`.
 * 

Definition at line 20 of file tailfileloghandler.hpp.


Constructor & Destructor Documentation

qi::log::TailFileLogHandler::TailFileLogHandler ( const std::string &  filePath)

Initialize the tail file log handler. File is opened on construction.

Parameters:
filePathpath to the file.
 * .. warning::
 *
 *      If the file could not be opened, it logs a warning and every log call
 *      will silently fail.
 * 

Closes the file.


Member Function Documentation

qi::log::TailFileLogHandler::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 the 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
msgmessage to log.
filefilename in the sources 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. see detailed description for more details on what "tail" means.


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