libqi-api
2.1.4.13
|
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... | |
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.
qi::log::TailFileLogHandler::TailFileLogHandler | ( | const std::string & | filePath | ) |
Initialize the tail file log handler. File is opened on construction.
filePath | path to the file. |
* .. warning:: * * If the file could not be opened, it logs a warning and every log call * will silently fail. *
|
virtual |
Closes the file.
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.
verb | verbosity of the log message. |
date | date at which the log message was issued. |
category | will be used in future for filtering |
msg | message to log. |
file | filename in the sources from which this log message was issued. |
fct | function name from which this log message was issued. |
line | line 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.