summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorPavel Filipenský <pfilipen@redhat.com>2022-06-19 15:40:37 +0200
committerAndreas Schneider <asn@cryptomilk.org>2022-07-15 14:25:37 +0000
commitf0e0a95320019ce2b2eac6350d95ec1fb3b2d563 (patch)
treea9ede9888aa0a3b901b5053c98ba93ee73e85051 /lib/util
parent8e2d05879eb701dad58d4f336c734c445527bed4 (diff)
downloadsamba-f0e0a95320019ce2b2eac6350d95ec1fb3b2d563.tar.gz
debug: Add DEBUGLF macro with explicit location and function parameters.
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/debug.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/util/debug.h b/lib/util/debug.h
index 40cae58e790..f58bb005145 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -199,6 +199,25 @@ void debuglevel_set_class(size_t idx, int level);
&& (dbghdrclass( level, DBGC_CLASS, __location__, __FUNCTION__ )) \
&& (dbgtext body) )
+/**
+ * @brief DEBUGLF is same as DEBUG with explicit location and function arguments
+ *
+ * To be used when passing location and function of a caller appearig earlier in
+ * the call stack instead of some helper function.
+ *
+ * @code
+ * DEBUGLF( 2, ("Some text.\n"), "foo.c:1", "foo" );
+ * DEBUGLF( 5, ("Some text.\n"), location, function );
+ * @endcode
+ *
+ * @return void.
+ */
+#define DEBUGLF( level, body, location, function ) \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ unlikely(debuglevel_get_class(DBGC_CLASS) >= (level)) \
+ && (dbghdrclass( level, DBGC_CLASS, location, function )) \
+ && (dbgtext body) )
+
#define DEBUGC( dbgc_class, level, body ) \
(void)( ((level) <= MAX_DEBUG_LEVEL) && \
unlikely(debuglevel_get_class(dbgc_class) >= (level)) \