summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:15:42 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:15:42 (EST)
commit8150da195475d0f868797dc125a138883bcb6ba7 (patch)
treeee9b3ecbd4219d4543488f8e11e8fd6e53aa26dc
parent635127c177a17e56bf78351890222def158936ee (diff)
opkg: add default message handler
git-svn-id: http://opkg.googlecode.com/svn/trunk@103 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg_message.c13
1 files changed, 10 insertions, 3 deletions
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);
+ }
}