Handler that writes to a file.
More...
#include <handler.h>
Handler that writes to a file.
...
logger.add_handler(
FileHandler(
"/var/log/router.log"));
FileHandler(const Path &path, bool format_messages=true, LogLevel level=LogLevel::kNotSet, LogTimestampPrecision timestamp_precision=LogTimestampPrecision::kNotSet)
Definition: handler.cc:163
static Logger logger
The "top-level" logger used when no connection context is given.
Definition: test_trace_plugin.cc:296
◆ FileHandler()
◆ ~FileHandler()
mysql_harness::logging::FileHandler::~FileHandler |
( |
| ) |
|
|
overridedefault |
◆ do_log()
void mysql_harness::logging::FileHandler::do_log |
( |
const Record & |
record | ) |
|
|
overrideprivatevirtual |
Log message handler primitive.
This member function is implemented by subclasses to properly log a record wherever it need to be logged. If it is not possible to log the message properly, an exception should be thrown and will be caught by the caller.
- Parameters
-
record | Record containing information about the message. |
Reimplemented from mysql_harness::logging::StreamHandler.
◆ reopen()
void mysql_harness::logging::FileHandler::reopen |
( |
const std::string |
dst = "" | ) |
|
|
overridevirtual |
Request to reopen underlying log sink.
Should be no-op for handlers NOT writing to a file. Useful for log rotation, when the logger got the signal with the request to reopen the file. Provide a destination filename for the old file for file based handlers.
Reimplemented from mysql_harness::logging::StreamHandler.
◆ file_path_
const Path mysql_harness::logging::FileHandler::file_path_ |
|
private |
◆ fstream_
std::ofstream mysql_harness::logging::FileHandler::fstream_ |
|
private |
◆ kDefaultName
constexpr const char* mysql_harness::logging::FileHandler::kDefaultName = "file" |
|
staticconstexpr |
The documentation for this class was generated from the following files:
- router/src/harness/include/mysql/harness/logging/handler.h
- router/src/harness/src/logging/handler.cc