projects
/
sven
/
fuse-exfat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update upstream source from tag 'upstream/1.4.0'
[sven/fuse-exfat.git]
/
libexfat
/
log.c
diff --git
a/libexfat/log.c
b/libexfat/log.c
index d62bf757128eea39d5a1f53f3b6d3da1c28561f4..dd2063b406cdb0bd7f4b5d17cf08f0b1834dd75a 100644
(file)
--- a/
libexfat/log.c
+++ b/
libexfat/log.c
@@
-3,7
+3,7
@@
exFAT file system implementation library.
Free exFAT implementation.
exFAT file system implementation library.
Free exFAT implementation.
- Copyright (C) 2010-20
18
Andrew Nayenko
+ Copyright (C) 2010-20
23
Andrew Nayenko
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-22,7
+22,11
@@
#include "exfat.h"
#include <stdarg.h>
#include "exfat.h"
#include <stdarg.h>
+#ifdef __ANDROID__
+#include <android/log.h>
+#else
#include <syslog.h>
#include <syslog.h>
+#endif
#include <unistd.h>
int exfat_errors;
#include <unistd.h>
int exfat_errors;
@@
-43,8
+47,12
@@
void exfat_bug(const char* format, ...)
va_end(ap);
fputs(".\n", stderr);
va_end(ap);
fputs(".\n", stderr);
+#ifdef __ANDROID__
+ __android_log_vprint(ANDROID_LOG_FATAL, PACKAGE, format, aq);
+#else
if (!isatty(STDERR_FILENO))
vsyslog(LOG_CRIT, format, aq);
if (!isatty(STDERR_FILENO))
vsyslog(LOG_CRIT, format, aq);
+#endif
va_end(aq);
abort();
va_end(aq);
abort();
@@
-67,8
+75,12
@@
void exfat_error(const char* format, ...)
va_end(ap);
fputs(".\n", stderr);
va_end(ap);
fputs(".\n", stderr);
+#ifdef __ANDROID__
+ __android_log_vprint(ANDROID_LOG_ERROR, PACKAGE, format, aq);
+#else
if (!isatty(STDERR_FILENO))
vsyslog(LOG_ERR, format, aq);
if (!isatty(STDERR_FILENO))
vsyslog(LOG_ERR, format, aq);
+#endif
va_end(aq);
}
va_end(aq);
}
@@
-89,8
+101,12
@@
void exfat_warn(const char* format, ...)
va_end(ap);
fputs(".\n", stderr);
va_end(ap);
fputs(".\n", stderr);
+#ifdef __ANDROID__
+ __android_log_vprint(ANDROID_LOG_WARN, PACKAGE, format, aq);
+#else
if (!isatty(STDERR_FILENO))
vsyslog(LOG_WARNING, format, aq);
if (!isatty(STDERR_FILENO))
vsyslog(LOG_WARNING, format, aq);
+#endif
va_end(aq);
}
va_end(aq);
}
@@
-99,12
+115,22
@@
void exfat_warn(const char* format, ...)
*/
void exfat_debug(const char* format, ...)
{
*/
void exfat_debug(const char* format, ...)
{
- va_list ap;
+ va_list ap, aq;
+
+ va_start(ap, format);
+ va_copy(aq, ap);
fflush(stdout);
fputs("DEBUG: ", stderr);
fflush(stdout);
fputs("DEBUG: ", stderr);
- va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
fputs(".\n", stderr);
vfprintf(stderr, format, ap);
va_end(ap);
fputs(".\n", stderr);
+
+#ifdef __ANDROID__
+ __android_log_vprint(ANDROID_LOG_DEBUG, PACKAGE, format, aq);
+#else
+ if (!isatty(STDERR_FILENO))
+ vsyslog(LOG_DEBUG, format, aq);
+#endif
+ va_end(aq);
}
}