summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2025-12-10 04:32:34 +0900
committerKoichi Sasada <ko1@atdot.net>2025-12-10 10:23:37 +0900
commit3bb97e7707a0be8c371cb9c704cb1e21062e1fc6 (patch)
tree36ef56a3bc3d00dcef3b5a886253b7d884935dbe /debug.c
parentf9eb0d8da2cb570c6cf7754e4078ed0de266a52c (diff)
`_RUBY_DEBUG_LOG` usable anywhere
even if `USE_RUBY_DEBUG_LOG=0`. It becomes `fprintf(stderr, ...)`.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/debug.c b/debug.c
index b92faa8f36..4daee2bd1c 100644
--- a/debug.c
+++ b/debug.c
@@ -708,4 +708,22 @@ ruby_debug_log_dump(const char *fname, unsigned int n)
fclose(fp);
}
}
+
+#else
+
+#undef ruby_debug_log
+void
+ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt, ...)
+{
+ va_list args;
+
+ fprintf(stderr, "[%s:%d] %s: ", file, line, func_name);
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+
+ fprintf(stderr, "\n");
+}
+
#endif // #if USE_RUBY_DEBUG_LOG