]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: trace: add a trace_no_cb() dummy callback for when to use no callback
authorWilly Tarreau <w@1wt.eu>
Tue, 24 Jan 2023 17:03:07 +0000 (18:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Jan 2023 14:49:43 +0000 (15:49 +0100)
By default, passing a NULL cb to the trace functions will result in the
source's default one to be used. For some cases we won't want to use any
callback at all, not event the default one. Let's define a trace_no_cb()
function for this, that does absolutely nothing.

include/haproxy/trace.h
src/trace.c

index 2c823e460d206d4231f66ded29ef116d751fd60c..2ddc8d58761d0a01dd8a026e3e352764f66483d7 100644 (file)
@@ -149,6 +149,10 @@ void __trace(enum trace_level level, uint64_t mask, struct trace_source *src,
                         const void *a1, const void *a2, const void *a3, const void *a4),
              const struct ist msg);
 
+void trace_no_cb(enum trace_level level, uint64_t mask, const struct trace_source *src,
+                const struct ist where, const struct ist func,
+                const void *a1, const void *a2, const void *a3, const void *a4);
+
 void trace_register_source(struct trace_source *source);
 
 /* return a single char to describe a trace state */
index 6aa155d44ebfc3b6b74b7d73ecba6cad90865fee..32fac61d394191fddf69d8d56838bfaf75880615 100644 (file)
@@ -298,6 +298,14 @@ void __trace(enum trace_level level, uint64_t mask, struct trace_source *src,
        }
 }
 
+/* this callback may be used when no output modification is desired */
+void trace_no_cb(enum trace_level level, uint64_t mask, const struct trace_source *src,
+                const struct ist where, const struct ist func,
+                const void *a1, const void *a2, const void *a3, const void *a4)
+{
+       /* do nothing */
+}
+
 /* registers trace source <source>. Modifies the list element!
  * The {start,pause,stop,report} events are not changed so the source may
  * preset them.