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