summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-07-24 19:29:28 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-07-24 21:55:54 (GMT)
commite6aeceb6068ace14ca530506fdfeb5f1cadd9a19 (patch)
treedd1c0e18870a03df7f8370711d57624ef5cf6889 /include
parentb28f31e7ed6c987bdbf3bdd9ce4aa63245926b4d (diff)
downloadjemalloc-e6aeceb6068ace14ca530506fdfeb5f1cadd9a19.zip
jemalloc-e6aeceb6068ace14ca530506fdfeb5f1cadd9a19.tar.gz
jemalloc-e6aeceb6068ace14ca530506fdfeb5f1cadd9a19.tar.bz2
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");
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/log.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/jemalloc/internal/log.h b/include/jemalloc/internal/log.h
index 5ce8c35..9f32fb4 100644
--- a/include/jemalloc/internal/log.h
+++ b/include/jemalloc/internal/log.h
@@ -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) \