1#ifndef foologhfoo
2#define foologhfoo
3
4/***
5  This file is part of avahi.
6
7  avahi is free software; you can redistribute it and/or modify it
8  under the terms of the GNU Lesser General Public License as
9  published by the Free Software Foundation; either version 2.1 of the
10  License, or (at your option) any later version.
11
12  avahi is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15  Public License for more details.
16
17  You should have received a copy of the GNU Lesser General Public
18  License along with avahi; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  USA.
21***/
22
23#include <stdarg.h>
24
25#include <avahi-common/cdecl.h>
26#include <avahi-common/gccmacro.h>
27
28/** \file log.h Extensible logging subsystem */
29
30AVAHI_C_DECL_BEGIN
31
32/** Log level for avahi_log_xxx() */
33typedef enum {
34    AVAHI_LOG_ERROR  = 0,    /**< Error messages */
35    AVAHI_LOG_WARN   = 1,    /**< Warning messages */
36    AVAHI_LOG_NOTICE = 2,    /**< Notice messages */
37    AVAHI_LOG_INFO   = 3,    /**< Info messages */
38    AVAHI_LOG_DEBUG  = 4,    /**< Debug messages */
39    AVAHI_LOG_LEVEL_MAX
40} AvahiLogLevel;
41
42/** Prototype for a user supplied log function */
43typedef void (*AvahiLogFunction)(AvahiLogLevel level, const char *txt);
44
45/** Set a user supplied log function, replacing the default which
46 * prints to log messages unconditionally to STDERR. Pass NULL for
47 * resetting to the default log function */
48void avahi_set_log_function(AvahiLogFunction function);
49
50/** Issue a log message using a va_list object */
51void avahi_log_ap(AvahiLogLevel level, const char *format, va_list ap);
52
53/** Issue a log message by passing a log level and a format string */
54void avahi_log(AvahiLogLevel level, const char*format, ...) AVAHI_GCC_PRINTF_ATTR23;
55
56/** Shortcut for avahi_log(AVAHI_LOG_ERROR, ...) */
57void avahi_log_error(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
58
59/** Shortcut for avahi_log(AVAHI_LOG_WARN, ...) */
60void avahi_log_warn(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
61
62/** Shortcut for avahi_log(AVAHI_LOG_NOTICE, ...) */
63void avahi_log_notice(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
64
65/** Shortcut for avahi_log(AVAHI_LOG_INFO, ...) */
66void avahi_log_info(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
67
68/** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */
69void avahi_log_debug(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
70
71AVAHI_C_DECL_END
72
73#endif
74