MINOR: trace: add a trace_no_cb() dummy callback for when to use no callback

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.
This commit is contained in:
Willy Tarreau 2023-01-24 18:03:07 +01:00
parent 8f9a9704bb
commit 4b36d5e8de
2 changed files with 12 additions and 0 deletions

View 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 */

View 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.