Began convertin all messaging to the logging system

This commit is contained in:
Peter Slattery 2021-04-13 03:12:59 -04:00
parent 5a1c37a23e
commit a983644f6b
7 changed files with 21 additions and 24 deletions

View File

@ -226,7 +226,7 @@ LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, gs_memory_arena
ErrorAt != 0; ErrorAt != 0;
ErrorAt = ErrorAt->Next) ErrorAt = ErrorAt->Next)
{ {
OutputDebugString(ErrorAt->Message.Str); Log_Error(GlobalLogBuffer, ErrorAt->Message.Str);
} }
} }

View File

@ -11,7 +11,6 @@
#include "engine/foldhaus_serializer.h" #include "engine/foldhaus_serializer.h"
#include "../gs_libs/gs_font.h" #include "../gs_libs/gs_font.h"
#include "engine/foldhaus_log.h"
#include "editor/interface.h" #include "editor/interface.h"
@ -48,8 +47,6 @@ typedef struct panel panel;
#include "ss_blumen_lumen/phrase_hue_map.h" #include "ss_blumen_lumen/phrase_hue_map.h"
#include "ss_blumen_lumen/blumen_lumen.h" #include "ss_blumen_lumen/blumen_lumen.h"
global log_buffer* GlobalLogBuffer;
struct app_state struct app_state
{ {
gs_memory_arena Permanent; gs_memory_arena Permanent;

View File

@ -29,6 +29,9 @@ Handle_IsValid(handle Handle)
#include "..\gs_libs\gs_string.h" #include "..\gs_libs\gs_string.h"
#include "..\gs_libs\gs_csv.h" #include "..\gs_libs\gs_csv.h"
#include "engine/foldhaus_log.h"
global log_buffer* GlobalLogBuffer;
#include "foldhaus_debug.h" #include "foldhaus_debug.h"
global debug_services* GlobalDebugServices; global debug_services* GlobalDebugServices;

View File

@ -397,7 +397,8 @@ Win32_SendAddressedDataBuffer(gs_thread_context Context, addressed_data_buffer*
else else
{ {
#if 0 #if 0
OutputDebugStringA("Skipping data buffer because its COM Port isn't set"); Log_Message(GlobalLogBuffer,
"Skipping data buffer because its COM Port isn't set");
#endif #endif
} }
}break; }break;
@ -422,11 +423,11 @@ ReloadAndLinkDLL(win32_dll_refresh* DLL, context* Context, gs_work_queue* WorkQu
SetApplicationLinks(Context, *DLL, WorkQueue); SetApplicationLinks(Context, *DLL, WorkQueue);
Context->ReloadStaticData(*Context, GlobalDebugServices, AppReady); Context->ReloadStaticData(*Context, GlobalDebugServices, AppReady);
Success = true; Success = true;
OutputDebugStringA("Reloaded DLL\n"); Log_Message(GlobalLogBuffer, "Reloaded DLL\n");
} }
else if(ShouldError) else if(ShouldError)
{ {
OutputDebugStringA("Unable to load application DLL at startup.\nAborting\n"); Log_Error(GlobalLogBuffer, "Unable to load application DLL at startup.\nAborting\n");
} }
return Success; return Success;
} }
@ -490,9 +491,9 @@ SetWorkingDirectory(HINSTANCE HInstance, gs_thread_context ThreadContext)
if (WorkingDirectory.Length > 0) if (WorkingDirectory.Length > 0)
{ {
OutputDebugStringA("Setting Working Directory\n"); Log_Message(GlobalLogBuffer,
OutputDebugStringA(WorkingDirectory.Str); "Setting Working Directory \n%S \n",
OutputDebugStringA("\n"); WorkingDirectory.ConstString);
Result = SetCurrentDirectory(WorkingDirectory.Str); Result = SetCurrentDirectory(WorkingDirectory.Str);
if (!Result) if (!Result)
{ {
@ -502,7 +503,7 @@ SetWorkingDirectory(HINSTANCE HInstance, gs_thread_context ThreadContext)
} }
else else
{ {
OutputDebugStringA("Error, no data folder found\n"); Log_Error(GlobalLogBuffer, "Error, no data folder found\n");
} }
return Result; return Result;
@ -601,7 +602,7 @@ WinMain (
gs_const_string Args = ConstString((char*)CmdLineArgs); gs_const_string Args = ConstString((char*)CmdLineArgs);
if (StringsEqual(Args, ConstString("-headless"))) if (StringsEqual(Args, ConstString("-headless")))
{ {
OutputDebugStringA("Running Headless\n"); Log_Message(GlobalLogBuffer, "Running Headless\n");
Context.Headless = true; Context.Headless = true;
} }
@ -707,9 +708,10 @@ WinMain (
u64 NanosElapsed = Context.SystemTime_Current.NanosSinceEpoch - StartTime.NanosSinceEpoch; u64 NanosElapsed = Context.SystemTime_Current.NanosSinceEpoch - StartTime.NanosSinceEpoch;
r64 SecondsElapsed = (r64)NanosElapsed * NanosToSeconds; r64 SecondsElapsed = (r64)NanosElapsed * NanosToSeconds;
PrintF(&T, "%lld %f Seconds\n", NanosElapsed, SecondsElapsed); Log_Message(GlobalLogBuffer,
NullTerminate(&T); "%lld %f Seconds \n",
OutputDebugStringA(T.Str); NanosElapsed,
SecondsElapsed);
#endif #endif
} }

View File

@ -212,7 +212,7 @@ Win32SerialPort_Write(HANDLE PortHandle, gs_data Buffer)
} }
else else
{ {
OutputDebugStringA("Error: Unable to write to port\n"); Log_Error(GlobalLogBuffer, "Error: Unable to write to port\n");
s32 Error = GetLastError(); s32 Error = GetLastError();
switch (Error) switch (Error)
{ {

View File

@ -444,10 +444,7 @@ BlumenLumen_ApplyNextHotHue(blumen_lumen_state* BLState, context Context, gs_str
// if we are in standard color mode, shift all flowers to the new color // if we are in standard color mode, shift all flowers to the new color
// otherwise, only shift the next flower in the sequence to the new color // otherwise, only shift the next flower in the sequence to the new color
phrase_hue NewHue = BLState->NextHotHue; phrase_hue NewHue = BLState->NextHotHue;
Log_Message(GlobalLogBuffer, "Switching To: %S\n", NewHue.Phrase);
PrintF(DebugStr, "Switching To: %S\n", NewHue.Phrase);
NullTerminate(DebugStr);
OutputDebugString(DebugStr->Str);
if (BLState->PatternMode == BlumenPattern_Standard || if (BLState->PatternMode == BlumenPattern_Standard ||
@ -499,9 +496,7 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
bool IsntInPhraseReceptionMode = !BLState->InPhraseReceptionMode; bool IsntInPhraseReceptionMode = !BLState->InPhraseReceptionMode;
if (IsLonger || IsntInPhraseReceptionMode) if (IsLonger || IsntInPhraseReceptionMode)
{ {
PrintF(&DebugStr, "Queuing: %S\n", NewHue.Phrase); Log_Message(GlobalLogBuffer, "Queueing: %S\n", NewHue.Phrase);
NullTerminate(&DebugStr);
OutputDebugString(DebugStr.Str);
BLState->NextHotHue = NewHue; BLState->NextHotHue = NewHue;
if (SecondsElapsed(BLState->TimePhraseReceptionBegan, if (SecondsElapsed(BLState->TimePhraseReceptionBegan,

View File

@ -127,7 +127,7 @@ CreateHueFromString(gs_const_string Str)
parse_float_result Parsed = ValidateAndParseFloat(Str); parse_float_result Parsed = ValidateAndParseFloat(Str);
if (!Parsed.Success) if (!Parsed.Success)
{ {
OutputDebugString("Failed to Parse CSV Float\n"); Log_Error(GlobalLogBuffer, "Failed to Parse CSV Float\n");
Parsed.Value = 0.0; Parsed.Value = 0.0;
} }
Result.HSV = v4{ (r32)Parsed.Value, 1, 1, 1 }; Result.HSV = v4{ (r32)Parsed.Value, 1, 1, 1 };