]> git.ipfire.org Git - thirdparty/squid.git/blob - lib/snmplib/snmplib_debug.c
SourceFormat Enforcement
[thirdparty/squid.git] / lib / snmplib / snmplib_debug.c
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10
11 #if HAVE_SYS_TYPES_H
12 #include <sys/types.h>
13 #endif
14 #include <stdarg.h>
15
16 #include "snmp_debug.h"
17
18 void (*snmplib_debug_hook) (int, char *,...) = NULL;
19
20 extern void
21 snmplib_debug(int lvl, const char *fmt,...)
22 {
23 char buf[BUFSIZ];
24 va_list args;
25 va_start(args, fmt);
26
27 if (snmplib_debug_hook != NULL) {
28 vsnprintf(buf, BUFSIZ, fmt, args);
29 snmplib_debug_hook(lvl, buf);
30 } else {
31 vfprintf(stderr, fmt, args);
32 }
33 va_end(args);
34 }
35