mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:24:12 +08:00
mdbx-test: don't filter lib's output by test's log-level.
Change-Id: Ieb45a532aee9b2a3d8ef11eb315b7eb01c1c0ef1
This commit is contained in:
parent
e6462dfe58
commit
72f2a315c4
35
test/log.cc
35
test/log.cc
@ -20,7 +20,7 @@ void failure(const char *fmt, ...) {
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
fflushall();
|
fflushall();
|
||||||
logging::output_ap(logging::failure, fmt, ap);
|
logging::output_nocheckloglevel_ap(logging::failure, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fflushall();
|
fflushall();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -45,10 +45,10 @@ static void mdbx_logger(int priority, const char *function, int line,
|
|||||||
if (priority == MDBX_LOG_FATAL)
|
if (priority == MDBX_LOG_FATAL)
|
||||||
log_error("mdbx: fatal failure: %s, %d", function, line);
|
log_error("mdbx: fatal failure: %s, %d", function, line);
|
||||||
|
|
||||||
if (logging::output(
|
logging::output_nocheckloglevel(
|
||||||
logging::loglevel(priority),
|
logging::loglevel(priority),
|
||||||
strncmp(function, "mdbx_", 5) == 0 ? "%s: " : "mdbx %s: ", function))
|
strncmp(function, "mdbx_", 5) == 0 ? "%s: " : "mdbx %s: ", function);
|
||||||
logging::feed_ap(msg, args);
|
logging::feed_ap(msg, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace logging {
|
namespace logging {
|
||||||
@ -103,13 +103,13 @@ bool output(const loglevel priority, const char *format, ...) {
|
|||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
output_ap(priority, format, ap);
|
output_nocheckloglevel_ap(priority, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool output_ap(const logging::loglevel priority, const char *format,
|
void output_nocheckloglevel_ap(const logging::loglevel priority,
|
||||||
va_list ap) {
|
const char *format, va_list ap) {
|
||||||
if (last) {
|
if (last) {
|
||||||
putc('\n', last);
|
putc('\n', last);
|
||||||
fflush(last);
|
fflush(last);
|
||||||
@ -120,9 +120,6 @@ bool output_ap(const logging::loglevel priority, const char *format,
|
|||||||
last = nullptr;
|
last = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lower(priority, level))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
chrono::time now = chrono::now_realtime();
|
chrono::time now = chrono::now_realtime();
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -182,8 +179,6 @@ bool output_ap(const logging::loglevel priority, const char *format,
|
|||||||
}
|
}
|
||||||
va_end(ones);
|
va_end(ones);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool feed_ap(const char *format, va_list ap) {
|
bool feed_ap(const char *format, va_list ap) {
|
||||||
@ -299,7 +294,7 @@ void log_extra(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::extra, logging::level)) {
|
if (logging::same_or_higher(logging::extra, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::extra, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::extra, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
@ -309,7 +304,7 @@ void log_trace(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::trace, logging::level)) {
|
if (logging::same_or_higher(logging::trace, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::trace, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::trace, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
@ -319,7 +314,7 @@ void log_debug(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::debug, logging::level)) {
|
if (logging::same_or_higher(logging::debug, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::debug, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::debug, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
@ -329,7 +324,7 @@ void log_verbose(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::verbose, logging::level)) {
|
if (logging::same_or_higher(logging::verbose, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::verbose, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::verbose, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
@ -339,7 +334,7 @@ void log_notice(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::notice, logging::level)) {
|
if (logging::same_or_higher(logging::notice, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::notice, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::notice, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
@ -349,7 +344,7 @@ void log_warning(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::warning, logging::level)) {
|
if (logging::same_or_higher(logging::warning, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::warning, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::warning, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
@ -359,7 +354,7 @@ void log_error(const char *msg, ...) {
|
|||||||
if (logging::same_or_higher(logging::error, logging::level)) {
|
if (logging::same_or_higher(logging::error, logging::level)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
logging::output_ap(logging::error, msg, ap);
|
logging::output_nocheckloglevel_ap(logging::error, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} else
|
} else
|
||||||
logging::last = nullptr;
|
logging::last = nullptr;
|
||||||
|
11
test/log.h
11
test/log.h
@ -49,12 +49,21 @@ void setup(loglevel priority, const std::string &prefix);
|
|||||||
void setup(const std::string &prefix);
|
void setup(const std::string &prefix);
|
||||||
void setlevel(loglevel priority);
|
void setlevel(loglevel priority);
|
||||||
|
|
||||||
bool output_ap(const loglevel priority, const char *format, va_list ap);
|
void output_nocheckloglevel_ap(const loglevel priority, const char *format,
|
||||||
|
va_list ap);
|
||||||
bool __printf_args(2, 3)
|
bool __printf_args(2, 3)
|
||||||
output(const loglevel priority, const char *format, ...);
|
output(const loglevel priority, const char *format, ...);
|
||||||
bool feed_ap(const char *format, va_list ap);
|
bool feed_ap(const char *format, va_list ap);
|
||||||
bool __printf_args(1, 2) feed(const char *format, ...);
|
bool __printf_args(1, 2) feed(const char *format, ...);
|
||||||
|
|
||||||
|
void inline __printf_args(2, 3)
|
||||||
|
output_nocheckloglevel(const loglevel priority, const char *format, ...) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
output_nocheckloglevel_ap(priority, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
void progress_canary(bool active);
|
void progress_canary(bool active);
|
||||||
|
|
||||||
class local_suffix {
|
class local_suffix {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user