From 544d78d7b74e45b3595bd264225ee974e11c7594 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Sun, 2 Jul 2023 17:10:33 -0400 Subject: [PATCH] Improve some log formatting on iOS/tvOS --- .../xcschemes/RetroArch iOS Debug.xcscheme | 6 ++++++ .../xcschemes/RetroArch iOS Release.xcscheme | 6 ++++++ verbosity.c | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/pkg/apple/RetroArch_iOS13.xcodeproj/xcshareddata/xcschemes/RetroArch iOS Debug.xcscheme b/pkg/apple/RetroArch_iOS13.xcodeproj/xcshareddata/xcschemes/RetroArch iOS Debug.xcscheme index c854fe168d..e810bb7785 100644 --- a/pkg/apple/RetroArch_iOS13.xcodeproj/xcshareddata/xcschemes/RetroArch iOS Debug.xcscheme +++ b/pkg/apple/RetroArch_iOS13.xcodeproj/xcshareddata/xcschemes/RetroArch iOS Debug.xcscheme @@ -60,6 +60,12 @@ ReferencedContainer = "container:RetroArch_iOS13.xcodeproj"> + + + + + + + + +#include #if TARGET_IPHONE_SIMULATOR #include #else +#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_10_0 || __TV_OS_VERSION_MIN_REQUIRED > __TVOS_10_0 +#include +#else #include #endif #endif +#endif #include #include @@ -282,6 +287,11 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) #if TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR vprintf(fmt, ap); +#elif __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_10_0 || __TV_OS_VERSION_MIN_REQUIRED > __TVOS_10_0 + int sz = vsnprintf(NULL, 0, fmt, ap) + 1; + char buffer[sz]; + vsnprintf(buffer, sz, fmt, ap); + os_log(OS_LOG_DEFAULT, "%s %s", tag_v, buffer); #else static aslclient asl_client; static int asl_initialized = 0; @@ -304,12 +314,14 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) #if defined(HAVE_LIBNX) mutexLock(&g_verbosity->mtx); #endif +#if !TARGET_OS_TV if (fp) { fprintf(fp, "%s ", tag_v); vfprintf(fp, fmt, ap); fflush(fp); } +#endif #if defined(HAVE_LIBNX) mutexUnlock(&g_verbosity->mtx); #endif