]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Add a handy debugging gadget that writes to logs.
authorJesse F. Williamson <jfw@ibm.com>
Wed, 14 Jan 2026 20:35:51 +0000 (12:35 -0800)
committerJesse F. Williamson <jfw@ibm.com>
Thu, 12 Feb 2026 18:53:32 +0000 (10:53 -0800)
It's surprisingly tricky to set up dout() and get it to work
usefully; you actually have to know a lot in order to do it, and
even then it can be very finnicky. This is an instrumentation tool
intended to make it straight forward to "just log something".

Signed-off-by: Jesse F. Williamson <jfw@ibm.com>
src/common/dout_fmt.h

index 036319fc6e3e7e50188214d158d22c9c27cffa18..88d1db2f613fad36359948fd30ad450a34e2d26e 100644 (file)
@@ -54,3 +54,25 @@ inline void dout_fmt_use_prefix(std::ostream&) {}
     fmt::print(*_dout, __VA_ARGS__); \
     *_dout << dendl; \
   }
+
+// This is useful for debugging during development, please do NOT leave calls to it lying around in production:
+inline void dout_trace(const std::string_view info, const std::string_view msg_tag = "dout-TRACE", const std::source_location sl = std::source_location::current())
+{
+ // ...this is an attempt only, as the extension is non-standard-- do NOT count on getting the values back:
+#pragma push_macro("dout_subsys")
+#pragma push_macro("dout_context")
+  
+ #define dout_subsys ceph_subsys_rgw
+ #define dout_context g_ceph_context
+
+ dout_fmt(0, "{} [{}]: {}", msg_tag, fmt::format("{}#{}", sl.file_name(), sl.function_name()), info);
+
+#pragma pop_macro("dout_subsys")
+#pragma pop_macro("dout_context")
+} 
+
+inline void dout_trace(const std::source_location sl = std::source_location::current())
+{
+ dout_trace("", "dout-TRACE", sl);
+} 
+