4 This file is part of avahi.
6 avahi is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 avahi is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14 Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with avahi; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
31 static AvahiLogFunction log_function = NULL;
33 void avahi_set_log_function(AvahiLogFunction function) {
34 log_function = function;
37 void avahi_log_ap(AvahiLogLevel level, const gchar*format, va_list ap) {
40 vsnprintf(txt, sizeof(txt), format, ap);
43 log_function(level, txt);
45 fprintf(stderr, "%s\n", txt);
48 void avahi_log(AvahiLogLevel level, const gchar*format, ...) {
51 avahi_log_ap(level, format, ap);
55 void avahi_log_error(const gchar*format, ...) {
58 avahi_log_ap(AVAHI_LOG_ERROR, format, ap);
62 void avahi_log_warn(const gchar*format, ...) {
65 avahi_log_ap(AVAHI_LOG_WARN, format, ap);
69 void avahi_log_notice(const gchar*format, ...) {
72 avahi_log_ap(AVAHI_LOG_NOTICE, format, ap);
76 void avahi_log_info(const gchar*format, ...) {
79 avahi_log_ap(AVAHI_LOG_INFO, format, ap);
83 void avahi_log_debug(const gchar*format, ...) {
86 avahi_log_ap(AVAHI_LOG_DEBUG, format, ap);