Fix RPMLINT error
[platform/core/uifw/anthy.git] / src-diclib / logger.c
1 /*
2  * ¥í¥°¤Î½ÐÎÏ
3  * $Id: logger.c,v 1.8 2002/05/14 13:24:47 yusuke Exp $
4  */
5 #include <stdio.h>
6 #include <stdarg.h>
7
8 #include <anthy/anthy.h>
9 #include <anthy/logger.h>
10
11 static void (*logger)(int lv, const char *str);
12 static int current_level = 1;
13
14 void
15 anthy_do_set_logger(void (*fn)(int lv, const char *str), int lv)
16 {
17   current_level = lv;
18   logger = fn;
19   /* to be implemented */
20 }
21
22 static void
23 do_log(int lv, const char *str, va_list arg)
24 {
25   if (lv < current_level) {
26     return ;
27   }
28   fprintf(stderr, "Anthy: ");
29   vfprintf(stderr, str, arg);
30 }
31
32 void
33 anthy_log(int lv, const char *str, ...)
34 {
35   va_list arg;
36   if (lv > current_level) {
37     return ;
38   }
39   va_start(arg, str);
40   do_log(lv, str, arg);
41   va_end(arg);
42 }
43
44 void
45 anthy_set_logger(anthy_logger lg, int level)
46 {
47   anthy_do_set_logger(lg, level);
48 }