summaryrefslogtreecommitdiff
path: root/vm_debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_debug.h')
-rw-r--r--vm_debug.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/vm_debug.h b/vm_debug.h
index 9b4fb3db7b..a3631c0309 100644
--- a/vm_debug.h
+++ b/vm_debug.h
@@ -89,14 +89,24 @@ extern enum ruby_debug_log_mode {
void ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt, ...);
void ruby_debug_log_print(unsigned int n);
+bool ruby_debug_log_filter(const char *func_name);
// convenient macro to log even if the USE_RUBY_DEBUG_LOG macro is not specified.
// You can use this macro for temporary usage (you should not commit it).
#define _RUBY_DEBUG_LOG(fmt, ...) ruby_debug_log(__FILE__, __LINE__, __func__, fmt, __VA_ARGS__)
#if USE_RUBY_DEBUG_LOG
-#define RUBY_DEBUG_LOG(fmt, ...) do { if (ruby_debug_log_mode) ruby_debug_log(__FILE__, __LINE__, __func__, fmt, __VA_ARGS__); } while (0)
-#define RUBY_DEBUG_LOG2(file, line, fmt, ...) do { if (ruby_debug_log_mode) ruby_debug_log(file, line, __func__, fmt, __VA_ARGS__); } while (0)
+
+#define RUBY_DEBUG_LOG(fmt, ...) do { \
+ if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \
+ ruby_debug_log(__FILE__, __LINE__, __func__, fmt, __VA_ARGS__); \
+} while (0)
+
+#define RUBY_DEBUG_LOG2(file, line, fmt, ...) do { \
+ if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \
+ ruby_debug_log(file, line, __func__, fmt, __VA_ARGS__); \
+} while (0)
+
#else
// do nothing
#define RUBY_DEBUG_LOG(fmt, ...)