Add 'NSLog' to Apple platform log in game

This commit is contained in:
Wojtek Figat
2023-05-17 18:56:40 +02:00
parent 04d61eba3c
commit 90603792d7
2 changed files with 9 additions and 0 deletions

View File

@@ -34,6 +34,7 @@
#include <mach-o/dyld.h>
#include <uuid/uuid.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
#include <CoreGraphics/CoreGraphics.h>
#include <SystemConfiguration/SystemConfiguration.h>
#include <IOKit/IOKitLib.h>
@@ -195,6 +196,13 @@ void ApplePlatform::GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int3
millisecond = time.tv_usec / 1000;
}
void ApplePlatform::Log(const StringView& msg)
{
#if !BUILD_RELEASE && !USE_EDITOR
NSLog(@"%s", StringAsANSI<>(*msg, msg.Length()).Get());
#endif
}
bool ApplePlatform::Init()
{
if (UnixPlatform::Init())

View File

@@ -79,6 +79,7 @@ public:
static uint64 GetClockFrequency();
static void GetSystemTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond);
static void GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond);
static void Log(const StringView& msg);
static bool Init();
static void Tick();
static void BeforeExit();