2 Unix SMB/CIFS implementation.
3 Copyright (C) Andrew Tridgell 2003
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 static void samba_tevent_debug(void *context
,
23 enum tevent_debug_level level
,
25 va_list ap
) PRINTF_ATTRIBUTE(3,0);
27 static void samba_tevent_debug(void *context
,
28 enum tevent_debug_level level
,
35 case TEVENT_DEBUG_FATAL
:
38 case TEVENT_DEBUG_ERROR
:
41 case TEVENT_DEBUG_WARNING
:
44 case TEVENT_DEBUG_TRACE
:
49 if (CHECK_DEBUGLVL(samba_level
)) {
50 const char *name
= (const char *)context
;
54 ret
= vasprintf(&message
, fmt
, ap
);
60 name
= "samba_tevent";
63 DEBUG(samba_level
, ("%s: %s", name
, message
));
68 void samba_tevent_set_debug(struct tevent_context
*ev
, const char *name
)
70 void *p
= discard_const(name
);
71 tevent_set_debug(ev
, samba_tevent_debug
, p
);
74 struct tevent_context
*samba_tevent_context_init(TALLOC_CTX
*mem_ctx
)
76 struct tevent_context
*ev
;
78 ev
= tevent_context_init(mem_ctx
);
80 samba_tevent_set_debug(ev
, NULL
);