mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-07 12:17:28 +03:00
Logging: log using the log var names directly.
Currently we have to log by writing something like:
static log_var_t log_a_b_c = LOG_VAR_INIT("a.b.c");
log (log_a_b_c, "msg");
This is sort of annoying. Let's just write:
log("a.b.c", "msg");
This commit is contained in:
parent
b28f31e7ed
commit
e6aeceb606
3 changed files with 51 additions and 155 deletions
|
|
@ -112,9 +112,10 @@ log_impl_varargs(const char *name, ...) {
|
|||
malloc_write(buf);
|
||||
}
|
||||
|
||||
/* Call as log(log_var, "format_string %d", arg_for_format_string); */
|
||||
#define log(log_var, ...) \
|
||||
/* Call as log("log.var.str", "format_string %d", arg_for_format_string); */
|
||||
#define log(log_var_str, ...) \
|
||||
do { \
|
||||
static log_var_t log_var = LOG_VAR_INIT(log_var_str); \
|
||||
log_do_begin(log_var) \
|
||||
log_impl_varargs((log_var).name, __VA_ARGS__); \
|
||||
log_do_end(log_var) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue