use CC_BUILD_MINFILES to disable chat/crash log code, instead of hardcoding to CC_BUILD_WEB

Also avoid referencing DateTime_CurrentLocal and related code in web client now
This commit is contained in:
UnknownShadow200 2020-05-20 20:45:02 +10:00
parent 19f1ff3aa7
commit 007473c9dc
3 changed files with 7 additions and 3 deletions

View File

@ -46,7 +46,7 @@ static void AppendChatLogTime(void) {
Chat_LogTime[logTimesCount++] = now;
}
#ifdef CC_BUILD_WEB
#ifdef CC_BUILD_MINFILES
static void ResetLogFile(void) { }
static void CloseLogFile(void) { }
void Chat_SetLogName(const String* name) { }

View File

@ -222,6 +222,7 @@ typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec;
#define CC_BUILD_GLES
#define CC_BUILD_TOUCH
#define CC_BUILD_NOAUDIO
#define CC_BUILD_MINFILES
#endif
#endif

View File

@ -824,8 +824,11 @@ void Logger_Abort2(cc_result result, const char* raw_msg) {
static struct Stream logStream;
static cc_bool logOpen;
#ifdef CC_BUILD_MINFILES
void Logger_Log(const String* msg) { }
static void Logger_LogCrashHeader(void) { }
#else
void Logger_Log(const String* msg) {
#ifndef CC_BUILD_WEB
static const String path = String_FromConst("client.log");
if (!logOpen) {
logOpen = true;
@ -834,7 +837,6 @@ void Logger_Log(const String* msg) {
if (!logStream.Meta.File) return;
Stream_Write(&logStream, (const cc_uint8*)msg->buffer, msg->length);
#endif
}
static void Logger_LogCrashHeader(void) {
@ -851,6 +853,7 @@ static void Logger_LogCrashHeader(void) {
String_Format3(&msg, "%p2:%p2:%p2" _NL, &now.hour, &now.minute, &now.second);
Logger_Log(&msg);
}
#endif
static void Logger_AbortCommon(cc_result result, const char* raw_msg, void* ctx) {
String msg; char msgBuffer[3070 + 1];