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::TailFileLogHandler Class Reference

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

#include <tailfileloghandler.hpp>

Public Member Functions

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

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.
* 
virtual qi::log::TailFileLogHandler::~TailFileLogHandler ( )
virtual

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: