OSDN Git Service

Fix Linux build
[android-x86/hardware-intel-libsensors.git] / linux / log.c
1 /*
2  * Copyright (C) 2014 Intel Corporation.
3  */
4
5 #include <stdarg.h>
6 #include <syslog.h>
7
8 static int log;
9
10 int __android_log_print(int prio, const char *tag, const char *fmt, ...)
11 {
12         va_list args;
13         int loglevel;
14
15         if (!log) {
16                 openlog("android", LOG_CONS, LOG_DAEMON);
17                 log = 1;
18         }
19
20         switch (prio) {
21         default:
22         case 0:
23         case 1:
24                 loglevel = LOG_INFO;
25                 break;
26         case 2:
27         case 3:
28                 loglevel = LOG_DEBUG;
29                 break;
30         case 4:
31                 loglevel = LOG_NOTICE;
32                 break;
33         case 5:
34                 loglevel = LOG_WARNING;
35                 break;
36         case 6:
37                 loglevel = LOG_ERR;
38                 break;
39         case 7:
40                 loglevel = LOG_EMERG;
41                 break;
42         }
43
44         va_start(args, fmt);
45         vsyslog(loglevel, fmt, args);
46         va_end(args);
47
48         return 0;
49 }