]> git.sven.stormbind.net Git - sven/fuse-exfat.git/blobdiff - libexfat/log.c
New upstream version 1.4.0
[sven/fuse-exfat.git] / libexfat / log.c
index f29f74b1d68c22f7702532a5bb933ea8709edc3b..dd2063b406cdb0bd7f4b5d17cf08f0b1834dd75a 100644 (file)
@@ -3,7 +3,7 @@
        exFAT file system implementation library.
 
        Free exFAT implementation.
-       Copyright (C) 2010-2018  Andrew Nayenko
+       Copyright (C) 2010-2023  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
@@ -115,12 +115,22 @@ void exfat_warn(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);
-       va_start(ap, format);
        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);
 }