1#ifndef foologhfoo 2#define foologhfoo 3 4/* $Id$ */ 5 6/*** 7 This file is part of avahi. 8 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. 13 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. 18 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 22 USA. 23***/ 24 25#include <stdarg.h> 26 27#include <avahi-common/cdecl.h> 28#include <avahi-common/gccmacro.h> 29 30/** \file log.h Extensible logging subsystem */ 31 32AVAHI_C_DECL_BEGIN 33 34/** Log level for avahi_log_xxx() */ 35typedef enum { 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 */ 41 AVAHI_LOG_LEVEL_MAX 42} AvahiLogLevel; 43 44/** Prototype for a user supplied log function */ 45typedef void (*AvahiLogFunction)(AvahiLogLevel level, const char *txt); 46 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 */ 50void avahi_set_log_function(AvahiLogFunction function); 51 52/** Issue a log message using a va_list object */ 53void avahi_log_ap(AvahiLogLevel level, const char *format, va_list ap); 54 55/** Issue a log message by passing a log level and a format string */ 56void avahi_log(AvahiLogLevel level, const char*format, ...) AVAHI_GCC_PRINTF_ATTR23; 57 58/** Shortcut for avahi_log(AVAHI_LOG_ERROR, ...) */ 59void avahi_log_error(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; 60 61/** Shortcut for avahi_log(AVAHI_LOG_WARN, ...) */ 62void avahi_log_warn(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; 63 64/** Shortcut for avahi_log(AVAHI_LOG_NOTICE, ...) */ 65void avahi_log_notice(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; 66 67/** Shortcut for avahi_log(AVAHI_LOG_INFO, ...) */ 68void avahi_log_info(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; 69 70/** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */ 71void avahi_log_debug(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; 72 73AVAHI_C_DECL_END 74 75#endif 76