MySQL 8.3.0
Source Code Documentation
logging.h File Reference

Logging interface for using and extending the logging subsystem. More...

#include "harness_export.h"
#include "mysql/harness/compiler_attributes.h"
#include "mysql/harness/filesystem.h"
#include "mysql/harness/stdx/process.h"
#include <chrono>
#include <cstdarg>
#include <fstream>
#include <list>
#include <mutex>
#include <string>

Go to the source code of this file.

Classes

struct  mysql_harness::logging::Record
 Log record containing information collected by the logging system. More...
 

Namespaces

namespace  mysql_harness
 
namespace  mysql_harness::logging
 

Macros

#define IMPORT_LOG_FUNCTIONS()
 convenience macro to avoid common boilerplate More...
 

Enumerations

enum class  mysql_harness::logging::LogLevel {
  mysql_harness::logging::kFatal , mysql_harness::logging::kSystem , mysql_harness::logging::kError , mysql_harness::logging::kWarning ,
  mysql_harness::logging::kInfo , mysql_harness::logging::kNote , mysql_harness::logging::kDebug , mysql_harness::logging::kNotSet
}
 Log level values. More...
 
enum class  mysql_harness::logging::LogTimestampPrecision {
  mysql_harness::logging::kSec = 0 , mysql_harness::logging::kMilliSec = 3 , mysql_harness::logging::kMicroSec = 6 , mysql_harness::logging::kNanoSec = 9 ,
  mysql_harness::logging::kNotSet
}
 Log timestamp precision values. More...
 

Functions

HARNESS_EXPORT bool mysql_harness::logging::log_level_is_handled (LogLevel level, const char *domain)
 
static bool mysql_harness::logging::log_level_is_handled (LogLevel level)
 

Variables

const size_t mysql_harness::logging::kLogMessageMaxSize = 4096
 Max message length that can be logged; if message is longer, it will be truncated to this length. More...
 
constexpr char mysql_harness::logging::kConfigOptionLogFilename [] = "filename"
 Section name and option name used in config file (and later in configuration object) to specify log level, best explained by example: More...
 
constexpr char mysql_harness::logging::kConfigOptionLogDestination [] = "destination"
 
constexpr char mysql_harness::logging::kConfigOptionLogLevel [] = "level"
 
constexpr char mysql_harness::logging::kConfigOptionLogTimestampPrecision [] = "timestamp_precision"
 
constexpr char mysql_harness::logging::kConfigSectionLogger [] = "logger"
 
constexpr char mysql_harness::logging::kNone [] = ""
 
constexpr char mysql_harness::logging::kMainLogger [] = "main"
 Special names reserved for "main" program logger. More...
 
constexpr char mysql_harness::logging::kMainLogHandler [] = "main_log_handler"
 
constexpr char mysql_harness::logging::kMainConsoleHandler [] = "main_console_handler"
 
constexpr char mysql_harness::logging::kSqlLogger [] = "sql"
 
constexpr char mysql_harness::logging::kDefaultLogFilename [] = "mysqlrouter.log"
 Default log filename. More...
 
const LogLevel mysql_harness::logging::kDefaultLogLevel = LogLevel::kWarning
 Default log level used by the router. More...
 
const char *const mysql_harness::logging::kDefaultLogLevelName = "warning"
 Log level name for the default log level used by the router. More...
 
const char *const mysql_harness::logging::kRawLogLevelName = "info"
 Log level name used in raw logging mode. More...
 
#define MYSQL_ROUTER_LOG_DOMAIN   ""
 Log message for the domain. More...
 
static void mysql_harness::logging::log_system (const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 
static void static void mysql_harness::logging::log_error (const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 
static void static void static void mysql_harness::logging::log_warning (const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 
static void static void static void static void mysql_harness::logging::log_info (const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 
static void static void static void static void static void mysql_harness::logging::log_note (const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 
static void static void static void static void static void static void mysql_harness::logging::log_debug (const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 
static void static void static void static void static void static void static void mysql_harness::logging::log_custom (const LogLevel log_level, const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
 

Detailed Description

Logging interface for using and extending the logging subsystem.

Macro Definition Documentation

◆ IMPORT_LOG_FUNCTIONS

#define IMPORT_LOG_FUNCTIONS ( )
Value:
static void static void static void static void static void static void static void log_custom(const LogLevel log_level, const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:295
static void static void log_error(const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:250
static void static void static void static void static void log_note(const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:277
static void log_system(const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:241
static void static void static void static void log_info(const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:268
static void static void static void static void static void static void log_debug(const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:286
static void static void static void log_warning(const char *fmt,...) ATTRIBUTE_GCC_FORMAT(printf
Definition: logging.h:259

convenience macro to avoid common boilerplate

◆ MYSQL_ROUTER_LOG_DOMAIN

#define MYSQL_ROUTER_LOG_DOMAIN   ""

Log message for the domain.

This will log an error, warning, informational, or debug message for the given domain. The domain have to be be registered before anything is being logged. The Loader uses the plugin name as the domain name, so normally you should provide the plugin name as the first argument to this function.

Parameters
nameDomain name to use when logging message.
fmtprintf-style format string, with arguments following. Pre-processor symbol containing the name of the log domain. If not defined explicitly when compiling, it will be an empty string, which means that it logs to the top log domain.