32#include "mysqld_error.h"
51#ifndef UNIV_NO_ERR_MSGS
56 template <
class... Args>
62 m_oss << msg(err, std::forward<Args>(args)...);
88 return (
m_oss.write(
reinterpret_cast<const char *
>(
buf),
count));
95#ifndef UNIV_NO_ERR_MSGS
109#ifndef UNIV_NO_ERR_MSGS
113 template <
class... Args>
114 static std::string
msg(
int err, Args &&...args) {
122 fprintf(stderr,
"The format '%s' does not match arguments\n", fmt);
127 ret = snprintf(
buf,
sizeof(
buf), fmt, std::forward<Args>(args)...);
131 if (ret > 0 && (
size_t)ret <
sizeof(
buf)) {
165 template <
class... Args>
168 m_oss << msg(err, std::forward<Args>(args)...);
191#ifndef UNIV_NO_ERR_MSGS
199 template <
class... Args>
212#ifndef UNIV_NO_ERR_MSGS
219 template <
class... Args>
233#ifndef UNIV_NO_ERR_MSGS
240 template <
class... Args>
255#ifndef UNIV_NO_ERR_MSGS
265 template <
class... Args>
288#ifndef UNIV_NO_ERR_MSGS
298 template <
class... Args>
301 std::forward<Args>(args)...) {}
310#ifndef UNIV_NO_ERR_MSGS
322 template <
class... Args>
351class trace_1 :
public logger {
353#ifndef UNIV_NO_ERR_MSGS
360 template <
class... Args>
361 explicit trace_1(
int err, Args &&...args)
374class trace_2 :
public logger {
376#ifndef UNIV_NO_ERR_MSGS
383 template <
class... Args>
384 explicit trace_2(
int err, Args &&...args)
396class trace_3 :
public logger {
398#ifndef UNIV_NO_ERR_MSGS
405 template <
class... Args>
406 explicit trace_3(
int err, Args &&...args)
458#ifdef UNIV_NO_ERR_MSGS
468template <
typename... Args>
470#ifdef UNIV_NO_ERR_MSGS
476template <
typename... Args>
478#ifdef UNIV_NO_ERR_MSGS
484template <
typename... Args>
486#ifdef UNIV_NO_ERR_MSGS
492template <
typename... Args>
494#ifdef UNIV_NO_ERR_MSGS
497 return ib::fatal(location,
err, std::forward<Args>(args)...);
500template <
typename... Args>
502#ifdef UNIV_NO_ERR_MSGS
508template <
typename... Args>
510 int err, Args &&...args) {
511#ifdef UNIV_NO_ERR_MSGS
519static inline auto log_trace_1() {
return ib::trace_1(); }
520static inline auto log_trace_2() {
return ib::trace_2(); }
521static inline auto log_trace_3() {
return ib::trace_3(); }
523template <
typename... Args>
524static inline auto log_trace_1(
int err, Args &&...args) {
525#ifdef UNIV_NO_ERR_MSGS
526 return log_trace_1();
528 return ib::trace_1(
err, std::forward<Args>(args)...);
531template <
typename... Args>
532static inline auto log_trace_2(
int err, Args &&...args) {
533#ifdef UNIV_NO_ERR_MSGS
534 return log_trace_2();
536 return ib::trace_2(
err, std::forward<Args>(args)...);
539template <
typename... Args>
540static inline auto log_trace_3(
int err, Args &&...args) {
541#ifdef UNIV_NO_ERR_MSGS
542 return log_trace_3();
544 return ib::trace_3(
err, std::forward<Args>(args)...);
Emit an error message if the given predicate is true, otherwise emit a warning message.
Definition: ut0log.h:286
error_or_warn(bool pred)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:292
error_or_warn(bool pred, int err, Args &&...args)
Constructor.
Definition: ut0log.h:299
The class error is used to emit error messages.
Definition: ut0log.h:231
error()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:235
error(int err, Args &&...args)
Constructor.
Definition: ut0log.h:241
Emit a fatal message if the given predicate is true, otherwise emit a error message.
Definition: ut0log.h:308
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:345
fatal_or_error(bool fatal, ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:314
fatal_or_error(bool fatal, ut::Location location, int err, Args &&...args)
Constructor.
Definition: ut0log.h:323
const bool m_fatal
If true then assert after printing an error message.
Definition: ut0log.h:343
~fatal_or_error() override
Destructor.
Definition: ut0ut.cc:533
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0log.h:253
~fatal() override
Destructor.
Definition: ut0ut.cc:525
fatal(ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:259
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:281
fatal(ut::Location location, int err, Args &&...args)
Constructor.
Definition: ut0log.h:266
The class info is used to emit informational log messages.
Definition: ut0log.h:189
info()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:194
info(int err, Args &&...args)
Constructor.
Definition: ut0log.h:200
The class logger is the base class of all the error log related classes.
Definition: ut0log.h:46
std::ostringstream m_oss
For converting the message into a string.
Definition: ut0log.h:93
std::ostream & write(const unsigned char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0log.h:87
static std::string msg(int err, Args &&...args)
Format an error message.
Definition: ut0log.h:114
std::ostream & write(const char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0log.h:79
void log_event(std::string msg)
Uses LogEvent to report the log entry, using provided message.
Definition: ut0ut.cc:508
logger(loglevel level)
Constructor.
Definition: ut0log.h:173
loglevel m_level
Error logging level.
Definition: ut0log.h:100
virtual ~logger()
Destructor.
Definition: ut0ut.cc:516
logger & log(int err, Args &&...args)
Format an error message.
Definition: ut0log.h:57
logger(loglevel level, int err, Args &&...args)
Constructor.
Definition: ut0log.h:166
int m_err
Error code in errmsg-*.txt.
Definition: ut0log.h:97
logger(loglevel level, int err)
Constructor.
Definition: ut0log.h:147
logger & operator<<(const T &rhs)
Definition: ut0log.h:70
The class warn is used to emit warnings.
Definition: ut0log.h:210
warn(int err, Args &&...args)
Constructor.
Definition: ut0log.h:220
warn()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:214
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:233
Definition of the global "loglevel" enumeration.
loglevel
Definition: my_loglevel.h:41
@ WARNING_LEVEL
Definition: my_loglevel.h:44
@ ERROR_LEVEL
Definition: my_loglevel.h:43
@ INFORMATION_LEVEL
Definition: my_loglevel.h:45
static int count
Definition: myisam_ftdump.cc:45
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
Definition: buf0block_hint.cc:30
Definition: ha_prototypes.h:342
static bool verify_fmt_match(const char *fmt)
Verifies that the fmt format string does not require any arguments.
Definition: ut0core.h:95
static auto log_error_or_warn(bool pred)
Definition: ut0log.h:457
static const char * get_first_format(const char *fmt)
Finds the first format specifier in fmt format string.
Definition: ut0core.h:83
static auto log_fatal(ut::Location location)
Definition: ut0log.h:454
static auto log_fatal_or_error(bool fatal, ut::Location location)
Definition: ut0log.h:464
static auto log_warn()
Definition: ut0log.h:452
static auto log_info()
Definition: ut0log.h:451
static auto log_error()
Definition: ut0log.h:453
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
Definition: gcs_xcom_synode.h:64
static Logger logger
The "top-level" logger used when no connection context is given.
Definition: test_trace_plugin.cc:296
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2872
#define ut_error
Abort execution.
Definition: ut0dbg.h:101
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
const char * srv_get_server_errmsgs(int errcode)
Get the format string for the logger.
Definition: srv0srv.cc:3271