mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Fix log.c: open_logging() sets log_pid and log_time vars
This commit is contained in:
parent
ff2c98afb3
commit
f50da147d6
4
log.c
4
log.c
@ -41,7 +41,7 @@ static struct strbuf logbuf = STRUCT_STRBUF_EMPTY;
|
||||
FILE *open_logging()
|
||||
{
|
||||
if (!logfile) {
|
||||
#ifndef ANDROID
|
||||
#ifdef ANDROID
|
||||
log_pid = log_time = 0;
|
||||
#endif
|
||||
const char *logpath = getenv("SERVALD_LOG_FILE");
|
||||
@ -89,6 +89,7 @@ void vlogMessage(int level, const char *file, unsigned int line, const char *fun
|
||||
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;
|
||||
@ -129,7 +130,6 @@ 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…
Reference in New Issue
Block a user