forked from linzj/force_load_shared_library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.cpp
39 lines (37 loc) · 699 Bytes
/
log.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "log.h"
#include <stdarg.h>
#include <stdio.h>
#ifdef __ANDROID__
#include <android/log.h>
#endif
void
logi (const char *fmt, ...)
{
char buf[512];
va_list va;
va_start (va, fmt);
int bytes = vsnprintf (buf, 511, fmt, va);
va_end (va);
buf[bytes] = '\0';
#ifndef __ANDROID__
fputs (buf, stdout);
#else
__android_log_write (ANDROID_LOG_INFO, "LINZJ", buf);
#endif
}
void
loge (const char *fmt, ...)
{
char buf[512];
va_list va;
va_start (va, fmt);
int bytes = vsnprintf (buf, 511, fmt, va);
va_end (va);
buf[bytes] = '\0';
#ifndef __ANDROID__
fputs (buf, stdout);
#else
fputs (buf, stderr);
__android_log_write (ANDROID_LOG_ERROR, "LINZJ", buf);
#endif
}