1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib/util: call tevent_set_max_debug_level() in samba_tevent_set_debug()

This means samba_tevent_debug() is only called when needed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2023-01-31 16:25:40 +01:00 committed by Andreas Schneider
parent 6a80d170bc
commit 0031a102c3

View File

@ -88,6 +88,17 @@ void samba_tevent_set_debug(struct tevent_context *ev, const char *name)
void *p = discard_const(name);
samba_tevent_setup_abort_fn();
tevent_set_debug(ev, samba_tevent_debug, p);
/* these values should match samba_tevent_debug() */
if (CHECK_DEBUGLVL(50)) {
tevent_set_max_debug_level(ev, TEVENT_DEBUG_TRACE);
} else if (CHECK_DEBUGLVL(2)) {
tevent_set_max_debug_level(ev, TEVENT_DEBUG_WARNING);
} else if (CHECK_DEBUGLVL(1)) {
tevent_set_max_debug_level(ev, TEVENT_DEBUG_ERROR);
} else {
tevent_set_max_debug_level(ev, TEVENT_DEBUG_FATAL);
}
}
struct tevent_context *samba_tevent_context_init(TALLOC_CTX *mem_ctx)