#include <sys/stat.h>
#include <sys/types.h>
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+
#include <freeswan.h>
#include <library.h>
#include <debug.h>
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
- if (log_to_syslog)
+ if (log_to_syslog
+#ifdef ANDROID
+ || TRUE
+#endif
+ )
{
/* write in memory buffer first */
vsnprintf(buffer, sizeof(buffer), fmt, args);
*(next++) = '\0';
}
syslog(priority, "%s%s\n", (level > 1)? "| ":"", current);
+#ifdef ANDROID
+ __android_log_print(level > 1 ? ANDROID_LOG_DEBUG
+ : ANDROID_LOG_INFO, "pluto",
+ "%s%s\n", level > 1 ? "| " : "", current);
+#endif
current = next;
}
}
syslog(LOG_WARNING, "%s", m);
if (log_to_perpeer)
peerlog("", m);
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_WARN, "pluto", "%s\n", m);
+#endif
whack_log(RC_LOG, "~%s", m);
}
syslog(LOG_WARNING, "%s", m);
if (log_to_perpeer)
peerlog("", m);
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_WARN, "pluto", "%s\n", m);
+#endif
whack_log(mess_no, "~%s", m);
}
if (log_to_syslog)
syslog(LOG_ERR, "ERROR: %s. Errno %d: %s", m, e, strerror(e));
if (log_to_perpeer)
- {
peerlog(strerror(e), m);
- }
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "pluto", "ERROR: %s. Errno %d: %s\n",
+ m, e, strerror(e));
+#endif
whack_log(RC_LOG_SERIOUS
, "~ERROR: %s. Errno %d: %s", m, e, strerror(e));
syslog(LOG_ERR, "FATAL ERROR: %s", m);
if (log_to_perpeer)
peerlog("FATAL ERROR: ", m);
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "pluto", "FATAL ERROR: %s\n", m);
+#endif
whack_log(RC_LOG_SERIOUS, "~FATAL ERROR: %s", m);
syslog(LOG_ERR, "FATAL ERROR: %s. Errno %d: %s", m, e, strerror(e));
if (log_to_perpeer)
peerlog(strerror(e), m);
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "pluto", "FATAL ERROR: %s. "
+ "Errno %d: %s\n", m, e, strerror(e));
+#endif
whack_log(RC_LOG_SERIOUS
, "~FATAL ERROR: %s. Errno %d: %s", m, e, strerror(e));
syslog(LOG_WARNING, "%s", m + prelen);
if (log_to_perpeer)
peerlog("", m);
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_WARN, "pluto", "%s\n", m + prelen);
+#endif
}
#endif
syslog(LOG_DEBUG, "| %s", m);
if (log_to_perpeer)
peerlog("| ", m);
+#ifdef ANDROID
+ __android_log_print(ANDROID_LOG_DEBUG, "pluto", "| %s\n", m);
+#endif
}
/* dump raw bytes in hex to stderr (for lack of any better destination) */