mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-31 08:25:22 +00:00
Fix compilation for android
This commit is contained in:
parent
38a5717789
commit
51d66f5d9e
8
log.c
8
log.c
@ -86,8 +86,9 @@ void logMessage(int level, const char *file, unsigned int line, const char *func
|
||||
void vlogMessage(int level, const char *file, unsigned int line, const char *function, const char *fmt, va_list ap)
|
||||
{
|
||||
if (level != LOG_LEVEL_SILENT) {
|
||||
if (strbuf_is_empty(&logbuf))
|
||||
strbuf_init(&logbuf, _log_buf, sizeof _log_buf);
|
||||
#ifndef ANDROID
|
||||
FILE *logf = open_logging();
|
||||
const char *levelstr = "UNKWN:";
|
||||
switch (level) {
|
||||
case LOG_LEVEL_FATAL: levelstr = "FATAL:"; break;
|
||||
@ -96,10 +97,8 @@ void vlogMessage(int level, const char *file, unsigned int line, const char *fun
|
||||
case LOG_LEVEL_WARN: levelstr = "WARN:"; break;
|
||||
case LOG_LEVEL_DEBUG: levelstr = "DEBUG:"; break;
|
||||
}
|
||||
#endif
|
||||
if (strbuf_is_empty(&logbuf))
|
||||
strbuf_init(&logbuf, _log_buf, sizeof _log_buf);
|
||||
strbuf_sprintf(&logbuf, "%-6s ", levelstr);
|
||||
#endif
|
||||
if (log_pid)
|
||||
strbuf_sprintf(&logbuf, "[%5u] ", getpid());
|
||||
if (log_time) {
|
||||
@ -130,6 +129,7 @@ void vlogMessage(int level, const char *file, unsigned int line, const char *fun
|
||||
__android_log_print(alevel, "servald", "%s", strbuf_str(&logbuf));
|
||||
strbuf_reset(&logbuf);
|
||||
#else
|
||||
FILE *logf = open_logging();
|
||||
if (logf) {
|
||||
fputs(strbuf_str(&logbuf), logf);
|
||||
if (strbuf_overrun(&logbuf))
|
||||
|
Loading…
x
Reference in New Issue
Block a user