From 8150da195475d0f868797dc125a138883bcb6ba7 Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 15 Dec 2008 00:15:42 -0500 Subject: opkg: add default message handler git-svn-id: http://opkg.googlecode.com/svn/trunk@103 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg') diff --git a/libopkg/opkg_message.c b/libopkg/opkg_message.c index 980d6a7..98b3c9d 100644 --- a/libopkg/opkg_message.c +++ b/libopkg/opkg_message.c @@ -26,11 +26,18 @@ opkg_message (opkg_conf_t * conf, message_level_t level, char *fmt, ...) va_list ap; char ts[256]; + va_start (ap, fmt); + vsnprintf (ts,256,fmt, ap); + va_end (ap); + if (opkg_cb_message) { - va_start (ap, fmt); - vsnprintf (ts,256,fmt, ap); - va_end (ap); opkg_cb_message(conf,level,ts); } + else + { + char *level_s[5] = {"ERROR", "NOTICE", "INFO", "DEBUG", "DEBUG2"}; + if (level <= conf->verbosity) + printf ("opkg-%s: %s", level_s[level], ts); + } } -- cgit v0.9.1