|
|
@@ -4,6 +4,10 @@
|
|
|
#include <stdarg.h>
|
|
|
#include <stdio.h>
|
|
|
|
|
|
+#if __APPLE__
|
|
|
+ #include <TargetConditionals.h>
|
|
|
+#endif
|
|
|
+
|
|
|
// TODO: Make better filenames; ie. enet_log.pid.txt
|
|
|
#define ENET_LOG_FILE "enet_log.txt"
|
|
|
|
|
|
@@ -37,7 +41,7 @@ static inline void enet_log(enum enet_log_type type, const char *func, int line,
|
|
|
|
|
|
time_buf[strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", local_time)] = '\0';
|
|
|
|
|
|
-#if ENET_ON_APPLE_IOS
|
|
|
+#if __APPLE__ && TARGET_OS_IPHONE
|
|
|
// https://github.com/SoftwareGuy/ENet-CSharp/issues/15
|
|
|
// iOS Debugging - File Access Permission (#blameApple)
|
|
|
// Can't write to files without the file permission... so don't do that if we're on Apple.
|
|
|
@@ -55,11 +59,12 @@ static inline void enet_log(enum enet_log_type type, const char *func, int line,
|
|
|
if (!enet_log_fp) enet_log_fp = fopen(ENET_LOG_FILE, "a");
|
|
|
if (!enet_log_fp) return;
|
|
|
|
|
|
- fprintf(enet_log_fp, "%s [%s] [%s:%d] \n", time_buf, enet_log_type_names[type], func, line);
|
|
|
+ fprintf(enet_log_fp, "%s [%s] [%s:%d] ", time_buf, enet_log_type_names[type], func, line);
|
|
|
va_start(args, fmt);
|
|
|
vfprintf(enet_log_fp, fmt, args);
|
|
|
va_end(args);
|
|
|
|
|
|
+ fprintf(enet_log_fp, "\n");
|
|
|
fflush(enet_log_fp);
|
|
|
#endif
|
|
|
|