50#ifndef UNIV_NO_ERR_MSGS
55 template <
class... Args>
61 m_oss << msg(err, std::forward<Args>(args)...);
87 return (
m_oss.write(
reinterpret_cast<const char *
>(
buf),
count));
94#ifndef UNIV_NO_ERR_MSGS
108#ifndef UNIV_NO_ERR_MSGS
112 template <
class... Args>
113 static std::string
msg(
int err, Args &&... args) {
121 fprintf(stderr,
"The format '%s' does not match arguments\n", fmt);
126 ret = snprintf(
buf,
sizeof(
buf), fmt, std::forward<Args>(args)...);
130 if (ret > 0 && (
size_t)ret <
sizeof(
buf)) {
164 template <
class... Args>
167 m_oss << msg(err, std::forward<Args>(args)...);
190#ifndef UNIV_NO_ERR_MSGS
198 template <
class... Args>
211#ifndef UNIV_NO_ERR_MSGS
218 template <
class... Args>
232#ifndef UNIV_NO_ERR_MSGS
239 template <
class... Args>
254#ifndef UNIV_NO_ERR_MSGS
264 template <
class... Args>
287#ifndef UNIV_NO_ERR_MSGS
297 template <
class... Args>
300 std::forward<Args>(args)...) {}
309#ifndef UNIV_NO_ERR_MSGS
321 template <
class... Args>
350class trace_1 :
public logger {
352#ifndef UNIV_NO_ERR_MSGS
359 template <
class... Args>
360 explicit trace_1(
int err, Args &&... args)
373class trace_2 :
public logger {
375#ifndef UNIV_NO_ERR_MSGS
382 template <
class... Args>
383 explicit trace_2(
int err, Args &&... args)
395class trace_3 :
public logger {
397#ifndef UNIV_NO_ERR_MSGS
404 template <
class... Args>
405 explicit trace_3(
int err, Args &&... args)
457#ifdef UNIV_NO_ERR_MSGS
467template <
typename... Args>
469#ifdef UNIV_NO_ERR_MSGS
475template <
typename... Args>
477#ifdef UNIV_NO_ERR_MSGS
483template <
typename... Args>
485#ifdef UNIV_NO_ERR_MSGS
491template <
typename... Args>
493#ifdef UNIV_NO_ERR_MSGS
496 return ib::fatal(location,
err, std::forward<Args>(args)...);
499template <
typename... Args>
501#ifdef UNIV_NO_ERR_MSGS
507template <
typename... Args>
509 int err, Args &&... args) {
510#ifdef UNIV_NO_ERR_MSGS
518static inline auto log_trace_1() {
return ib::trace_1(); }
519static inline auto log_trace_2() {
return ib::trace_2(); }
520static inline auto log_trace_3() {
return ib::trace_3(); }
522template <
typename... Args>
523static inline auto log_trace_1(
int err, Args &&... args) {
524#ifdef UNIV_NO_ERR_MSGS
525 return log_trace_1();
527 return ib::trace_1(
err, std::forward<Args>(args)...);
530template <
typename... Args>
531static inline auto log_trace_2(
int err, Args &&... args) {
532#ifdef UNIV_NO_ERR_MSGS
533 return log_trace_2();
535 return ib::trace_2(
err, std::forward<Args>(args)...);
538template <
typename... Args>
539static inline auto log_trace_3(
int err, Args &&... args) {
540#ifdef UNIV_NO_ERR_MSGS
541 return log_trace_3();
543 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:285
error_or_warn(bool pred)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:291
error_or_warn(bool pred, int err, Args &&... args)
Constructor.
Definition: ut0log.h:298
The class error is used to emit error messages.
Definition: ut0log.h:230
error()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:234
error(int err, Args &&... args)
Constructor.
Definition: ut0log.h:240
Emit a fatal message if the given predicate is true, otherwise emit a error message.
Definition: ut0log.h:307
fatal_or_error(bool fatal, ut::Location location, int err, Args &&... args)
Constructor.
Definition: ut0log.h:322
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:344
fatal_or_error(bool fatal, ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:313
const bool m_fatal
If true then assert after printing an error message.
Definition: ut0log.h:342
~fatal_or_error() override
Destructor.
Definition: ut0ut.cc:529
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0log.h:252
~fatal() override
Destructor.
Definition: ut0ut.cc:521
fatal(ut::Location location)
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:258
fatal(ut::Location location, int err, Args &&... args)
Constructor.
Definition: ut0log.h:265
ut::Location m_location
Location of the original caller to report to assertion failure.
Definition: ut0log.h:280
The class info is used to emit informational log messages.
Definition: ut0log.h:188
info(int err, Args &&... args)
Constructor.
Definition: ut0log.h:199
info()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:193
The class logger is the base class of all the error log related classes.
Definition: ut0log.h:45
std::ostringstream m_oss
For converting the message into a string.
Definition: ut0log.h:92
static std::string msg(int err, Args &&... args)
Format an error message.
Definition: ut0log.h:113
std::ostream & write(const unsigned char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0log.h:86
std::ostream & write(const char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0log.h:78
void log_event(std::string msg)
Uses LogEvent to report the log entry, using provided message.
Definition: ut0ut.cc:504
logger(loglevel level)
Constructor.
Definition: ut0log.h:172
loglevel m_level
Error logging level.
Definition: ut0log.h:99
virtual ~logger()
Destructor.
Definition: ut0ut.cc:512
logger(loglevel level, int err, Args &&... args)
Constructor.
Definition: ut0log.h:165
int m_err
Error code in errmsg-*.txt.
Definition: ut0log.h:96
logger & log(int err, Args &&... args)
Format an error message.
Definition: ut0log.h:56
logger(loglevel level, int err)
Constructor.
Definition: ut0log.h:146
logger & operator<<(const T &rhs)
Definition: ut0log.h:69
The class warn is used to emit warnings.
Definition: ut0log.h:209
warn(int err, Args &&... args)
Constructor.
Definition: ut0log.h:219
warn()
Default constructor uses ER_IB_MSG_0.
Definition: ut0log.h:213
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:225
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:43
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
Definition: buf0block_hint.cc:30
static bool verify_fmt_match(const char *fmt)
Verifies that the fmt format string does not require any arguments.
Definition: ut0core.h:69
static auto log_error_or_warn(bool pred)
Definition: ut0log.h:456
static const char * get_first_format(const char *fmt)
Finds the first format specifier in fmt format string.
Definition: ut0core.h:57
static auto log_fatal(ut::Location location)
Definition: ut0log.h:453
static auto log_fatal_or_error(bool fatal, ut::Location location)
Definition: ut0log.h:463
static auto log_warn()
Definition: ut0log.h:451
static auto log_info()
Definition: ut0log.h:450
static auto log_error()
Definition: ut0log.h:452
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:910
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:2870
#define ut_error
Abort execution.
Definition: ut0dbg.h:65
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:57
const char * srv_get_server_errmsgs(int errcode)
Get the format string for the logger.
Definition: srv0srv.cc:3265