s4:lib/events: make use of samba_tevent_set_debug()
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Feb 2013 07:35:50 +0000 (08:35 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 28 Feb 2013 11:12:36 +0000 (12:12 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source4/lib/events/tevent_s4.c

index 6770dd07af859f33a0ffa6ef3956c3d00ec6c9b4..f80424f71f5375c035139d5a2dcfadcfc05b48e5 100644 (file)
 #define TEVENT_DEPRECATED 1
 #include "lib/events/events.h"
 
-/*
-  this is used to catch debug messages from events
-*/
-static void ev_wrap_debug(void *context, enum tevent_debug_level level,
-                         const char *fmt, va_list ap)  PRINTF_ATTRIBUTE(3,0);
-
-static void ev_wrap_debug(void *context, enum tevent_debug_level level,
-                         const char *fmt, va_list ap)
-{
-       int samba_level = -1;
-       char *s = NULL;
-       switch (level) {
-       case TEVENT_DEBUG_FATAL:
-               samba_level = 0;
-               break;
-       case TEVENT_DEBUG_ERROR:
-               samba_level = 1;
-               break;
-       case TEVENT_DEBUG_WARNING:
-               samba_level = 2;
-               break;
-       case TEVENT_DEBUG_TRACE:
-               samba_level = 50;
-               break;
-
-       };
-       if (CHECK_DEBUGLVL(samba_level)) {
-               vasprintf(&s, fmt, ap);
-               if (!s) return;
-               DEBUG(samba_level, ("tevent: %s", s));
-               free(s);
-       }
-}
-
 /*
   create a event_context structure. This must be the first events
   call, and all subsequent calls pass this event_context as the first
@@ -67,7 +33,7 @@ struct tevent_context *s4_event_context_init(TALLOC_CTX *mem_ctx)
 
        ev = tevent_context_init_byname(mem_ctx, NULL);
        if (ev) {
-               tevent_set_debug(ev, ev_wrap_debug, NULL);
+               samba_tevent_set_debug(ev, "s4_tevent");
                tevent_loop_allow_nesting(ev);
        }
        return ev;