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) {
121 fprintf(stderr,
"The format '%s' does not match arguments\n", fmt);
127 snprintf(
buf,
sizeof(
buf), fmt, std::forward<Args>(args)...);
129 return (ret > 0 && (
size_t)ret <
sizeof(
buf)) ?
buf :
"";
159 template <
class... Args>
162 m_oss << msg(err, std::forward<Args>(args)...);
185#ifndef UNIV_NO_ERR_MSGS
193 template <
class... Args>
206#ifndef UNIV_NO_ERR_MSGS
213 template <
class... Args>
227#ifndef UNIV_NO_ERR_MSGS
234 template <
class... Args>
249#ifndef UNIV_NO_ERR_MSGS
259 template <
class... Args>
271 [[noreturn]]
~fatal()
override;
282#ifndef UNIV_NO_ERR_MSGS
292 template <
class... Args>
295 std::forward<Args>(args)...) {}
304#ifndef UNIV_NO_ERR_MSGS
316 template <
class... Args>
345class trace_1 :
public logger {
347#ifndef UNIV_NO_ERR_MSGS
354 template <
class... Args>
355 explicit trace_1(
int err, Args &&...args)
368class trace_2 :
public logger {
370#ifndef UNIV_NO_ERR_MSGS
377 template <
class... Args>
378 explicit trace_2(
int err, Args &&...args)
390class trace_3 :
public logger {
392#ifndef UNIV_NO_ERR_MSGS
399 template <
class... Args>
400 explicit trace_3(
int err, Args &&...args)
452#ifdef UNIV_NO_ERR_MSGS
462template <
typename... Args>
464#ifdef UNIV_NO_ERR_MSGS
470template <
typename... Args>
472#ifdef UNIV_NO_ERR_MSGS
478template <
typename... Args>
480#ifdef UNIV_NO_ERR_MSGS
486template <
typename... Args>
488#ifdef UNIV_NO_ERR_MSGS
491 return ib::fatal(location,
err, std::forward<Args>(args)...);
494template <
typename... Args>
496#ifdef UNIV_NO_ERR_MSGS
502template <
typename... Args>
504 int err, Args &&...args) {
505#ifdef UNIV_NO_ERR_MSGS
513static inline auto log_trace_1() {
return ib::trace_1(); }
514static inline auto log_trace_2() {
return ib::trace_2(); }
515static inline auto log_trace_3() {
return ib::trace_3(); }
517template <
typename... Args>
518static inline auto log_trace_1(
int err, Args &&...args) {
519#ifdef UNIV_NO_ERR_MSGS
520 return log_trace_1();
522 return ib::trace_1(
err, std::forward<Args>(args)...);
525template <
typename... Args>
526static inline auto log_trace_2(
int err, Args &&...args) {
527#ifdef UNIV_NO_ERR_MSGS
528 return log_trace_2();
530 return ib::trace_2(
err, std::forward<Args>(args)...);
533template <
typename... Args>
534static inline auto log_trace_3(
int err, Args &&...args) {
535#ifdef UNIV_NO_ERR_MSGS
536 return log_trace_3();
538 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:280
error_or_warn(bool pred)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:286
error_or_warn(bool pred, int err, Args &&...args)
Constructor.
Definition: ut0log.h:293
The class error is used to emit error messages.
Definition: ut0log.h:225
error()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:229
error(int err, Args &&...args)
Constructor.
Definition: ut0log.h:235
Emit a fatal message if the given predicate is true, otherwise emit a error message.
Definition: ut0log.h:302
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:339
fatal_or_error(bool fatal, ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:308
fatal_or_error(bool fatal, ut::Location location, int err, Args &&...args)
Constructor.
Definition: ut0log.h:317
const bool m_fatal
If true then assert after printing an error message.
Definition: ut0log.h:337
~fatal_or_error() override
Destructor.
Definition: ut0ut.cc:536
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0log.h:247
~fatal() override
Destructor.
Definition: ut0ut.cc:528
fatal(ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:253
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:275
fatal(ut::Location location, int err, Args &&...args)
Constructor.
Definition: ut0log.h:260
The class info is used to emit informational log messages.
Definition: ut0log.h:183
info()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:188
info(int err, Args &&...args)
Constructor.
Definition: ut0log.h:194
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:511
logger(loglevel level)
Constructor.
Definition: ut0log.h:167
loglevel m_level
Error logging level.
Definition: ut0log.h:100
virtual ~logger()
Destructor.
Definition: ut0ut.cc:519
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:160
int m_err
Error code in errmsg-*.txt.
Definition: ut0log.h:97
logger(loglevel level, int err)
Constructor.
Definition: ut0log.h:141
logger & operator<<(const T &rhs)
Definition: ut0log.h:70
The class warn is used to emit warnings.
Definition: ut0log.h:204
warn(int err, Args &&...args)
Constructor.
Definition: ut0log.h:214
warn()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:208
static char buf[MAX_BUF]
Definition: conf_to_src.cc:74
#define T
Definition: jit_executor_value.cc:373
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:234
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
Definition: buf0block_hint.cc:30
Definition: fil0fil.cc:1392
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:451
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:448
static auto log_fatal_or_error(bool fatal, ut::Location location)
Definition: ut0log.h:458
static auto log_warn()
Definition: ut0log.h:446
static auto log_info()
Definition: ut0log.h:445
static auto log_error()
Definition: ut0log.h:447
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:943
Define std::hash<Gtid>.
Definition: gtid.h:355
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:2720
#define ut_error
Abort execution.
Definition: ut0dbg.h:105
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:97
const char * srv_get_server_errmsgs(int errcode)
Get the format string for the logger.
Definition: srv0srv.cc:3256