49#ifndef UNIV_NO_ERR_MSGS
54 template <
class... Args>
60 m_oss << msg(err, std::forward<Args>(args)...);
86 return (
m_oss.write(
reinterpret_cast<const char *
>(
buf),
count));
93#ifndef UNIV_NO_ERR_MSGS
107#ifndef UNIV_NO_ERR_MSGS
111 template <
class... Args>
112 static std::string
msg(
int err, Args &&... args) {
120 fprintf(stderr,
"The format '%s' does not match arguments\n", fmt);
125 ret = snprintf(
buf,
sizeof(
buf), fmt, std::forward<Args>(args)...);
129 if (ret > 0 && (
size_t)ret <
sizeof(
buf)) {
163 template <
class... Args>
166 m_oss << msg(err, std::forward<Args>(args)...);
189#ifndef UNIV_NO_ERR_MSGS
197 template <
class... Args>
210#ifndef UNIV_NO_ERR_MSGS
217 template <
class... Args>
231#ifndef UNIV_NO_ERR_MSGS
238 template <
class... Args>
253#ifndef UNIV_NO_ERR_MSGS
263 template <
class... Args>
286#ifndef UNIV_NO_ERR_MSGS
296 template <
class... Args>
299 std::forward<Args>(args)...) {}
308#ifndef UNIV_NO_ERR_MSGS
320 template <
class... Args>
349class trace_1 :
public logger {
351#ifndef UNIV_NO_ERR_MSGS
358 template <
class... Args>
359 explicit trace_1(
int err, Args &&... args)
372class trace_2 :
public logger {
374#ifndef UNIV_NO_ERR_MSGS
381 template <
class... Args>
382 explicit trace_2(
int err, Args &&... args)
394class trace_3 :
public logger {
396#ifndef UNIV_NO_ERR_MSGS
403 template <
class... Args>
404 explicit trace_3(
int err, Args &&... args)
456#ifdef UNIV_NO_ERR_MSGS
466template <
typename... Args>
468#ifdef UNIV_NO_ERR_MSGS
474template <
typename... Args>
476#ifdef UNIV_NO_ERR_MSGS
482template <
typename... Args>
484#ifdef UNIV_NO_ERR_MSGS
490template <
typename... Args>
492#ifdef UNIV_NO_ERR_MSGS
495 return ib::fatal(location,
err, std::forward<Args>(args)...);
498template <
typename... Args>
500#ifdef UNIV_NO_ERR_MSGS
506template <
typename... Args>
508 int err, Args &&... args) {
509#ifdef UNIV_NO_ERR_MSGS
517static inline auto log_trace_1() {
return ib::trace_1(); }
518static inline auto log_trace_2() {
return ib::trace_2(); }
519static inline auto log_trace_3() {
return ib::trace_3(); }
521template <
typename... Args>
522static inline auto log_trace_1(
int err, Args &&... args) {
523#ifdef UNIV_NO_ERR_MSGS
524 return log_trace_1();
526 return ib::trace_1(
err, std::forward<Args>(args)...);
529template <
typename... Args>
530static inline auto log_trace_2(
int err, Args &&... args) {
531#ifdef UNIV_NO_ERR_MSGS
532 return log_trace_2();
534 return ib::trace_2(
err, std::forward<Args>(args)...);
537template <
typename... Args>
538static inline auto log_trace_3(
int err, Args &&... args) {
539#ifdef UNIV_NO_ERR_MSGS
540 return log_trace_3();
542 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:284
error_or_warn(bool pred)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:290
error_or_warn(bool pred, int err, Args &&... args)
Constructor.
Definition: ut0log.h:297
The class error is used to emit error messages.
Definition: ut0log.h:229
error()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:233
error(int err, Args &&... args)
Constructor.
Definition: ut0log.h:239
Emit a fatal message if the given predicate is true, otherwise emit a error message.
Definition: ut0log.h:306
fatal_or_error(bool fatal, ut::Location location, int err, Args &&... args)
Constructor.
Definition: ut0log.h:321
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:343
fatal_or_error(bool fatal, ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:312
const bool m_fatal
If true then assert after printing an error message.
Definition: ut0log.h:341
~fatal_or_error() override
Destructor.
Definition: ut0ut.cc:528
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0log.h:251
~fatal() override
Destructor.
Definition: ut0ut.cc:520
fatal(ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:257
fatal(ut::Location location, int err, Args &&... args)
Constructor.
Definition: ut0log.h:264
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:279
The class info is used to emit informational log messages.
Definition: ut0log.h:187
info(int err, Args &&... args)
Constructor.
Definition: ut0log.h:198
info()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:192
The class logger is the base class of all the error log related classes.
Definition: ut0log.h:44
std::ostringstream m_oss
For converting the message into a string.
Definition: ut0log.h:91
static std::string msg(int err, Args &&... args)
Format an error message.
Definition: ut0log.h:112
std::ostream & write(const unsigned char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0log.h:85
std::ostream & write(const char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0log.h:77
void log_event(std::string msg)
Uses LogEvent to report the log entry, using provided message.
Definition: ut0ut.cc:503
logger(loglevel level)
Constructor.
Definition: ut0log.h:171
loglevel m_level
Error logging level.
Definition: ut0log.h:98
virtual ~logger()
Destructor.
Definition: ut0ut.cc:511
logger(loglevel level, int err, Args &&... args)
Constructor.
Definition: ut0log.h:164
int m_err
Error code in errmsg-*.txt.
Definition: ut0log.h:95
logger & log(int err, Args &&... args)
Format an error message.
Definition: ut0log.h:55
logger(loglevel level, int err)
Constructor.
Definition: ut0log.h:145
logger & operator<<(const T &rhs)
Definition: ut0log.h:68
The class warn is used to emit warnings.
Definition: ut0log.h:208
warn(int err, Args &&... args)
Constructor.
Definition: ut0log.h:218
warn()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:212
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:224
Definition of the global "loglevel" enumeration.
loglevel
Definition: my_loglevel.h:40
@ WARNING_LEVEL
Definition: my_loglevel.h:43
@ ERROR_LEVEL
Definition: my_loglevel.h:42
@ INFORMATION_LEVEL
Definition: my_loglevel.h:44
static int count
Definition: myisam_ftdump.cc:42
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1063
Definition: buf0block_hint.cc:29
static bool verify_fmt_match(const char *fmt)
Verifies that the fmt format string does not require any arguments.
Definition: ut0core.h:68
static auto log_error_or_warn(bool pred)
Definition: ut0log.h:455
static const char * get_first_format(const char *fmt)
Finds the first format specifier in fmt format string.
Definition: ut0core.h:56
static auto log_fatal(ut::Location location)
Definition: ut0log.h:452
static auto log_fatal_or_error(bool fatal, ut::Location location)
Definition: ut0log.h:462
static auto log_warn()
Definition: ut0log.h:450
static auto log_info()
Definition: ut0log.h:449
static auto log_error()
Definition: ut0log.h:451
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:909
Definition: varlen_sort.h:183
static Logger logger
The "top-level" logger used when no connection context is given.
Definition: test_trace_plugin.cc:295
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2868
#define ut_error
Abort execution.
Definition: ut0dbg.h:64
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:56
const char * srv_get_server_errmsgs(int errcode)
Get the format string for the logger.
Definition: srv0srv.cc:3267