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 = ErrorAt->Next)
{
OutputDebugString(ErrorAt->Message.Str);
Log_Error(GlobalLogBuffer, ErrorAt->Message.Str);
}
}

View File

@ -11,7 +11,6 @@
#include "engine/foldhaus_serializer.h"
#include "../gs_libs/gs_font.h"
#include "engine/foldhaus_log.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/blumen_lumen.h"
global log_buffer* GlobalLogBuffer;
struct app_state
{
gs_memory_arena Permanent;

View File

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

View File

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

View File

@ -212,7 +212,7 @@ Win32SerialPort_Write(HANDLE PortHandle, gs_data Buffer)
}
else
{
OutputDebugStringA("Error: Unable to write to port\n");
Log_Error(GlobalLogBuffer, "Error: Unable to write to port\n");
s32 Error = GetLastError();
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
// otherwise, only shift the next flower in the sequence to the new color
phrase_hue NewHue = BLState->NextHotHue;
PrintF(DebugStr, "Switching To: %S\n", NewHue.Phrase);
NullTerminate(DebugStr);
OutputDebugString(DebugStr->Str);
Log_Message(GlobalLogBuffer, "Switching To: %S\n", NewHue.Phrase);
if (BLState->PatternMode == BlumenPattern_Standard ||
@ -499,9 +496,7 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
bool IsntInPhraseReceptionMode = !BLState->InPhraseReceptionMode;
if (IsLonger || IsntInPhraseReceptionMode)
{
PrintF(&DebugStr, "Queuing: %S\n", NewHue.Phrase);
NullTerminate(&DebugStr);
OutputDebugString(DebugStr.Str);
Log_Message(GlobalLogBuffer, "Queueing: %S\n", NewHue.Phrase);
BLState->NextHotHue = NewHue;
if (SecondsElapsed(BLState->TimePhraseReceptionBegan,

View File

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