Browse Source

Update logging

Use our log function instead of bare printf calls.
master
TheoryOfNekomata 1 year ago
parent
commit
48fb8abd6e
2 changed files with 11 additions and 6 deletions
  1. +10
    -5
      src/packages/game/IZ_app_net.c
  2. +1
    -1
      src/packages/game/data/IZ_list.c

+ 10
- 5
src/packages/game/IZ_app_net.c View File

@@ -1,17 +1,22 @@
#include "IZ_app_net.h"

void IZ_AppHandleNetworkingInboundBinaryEvents(struct IZ_App* app, void* binary_raw, size_t len) {
if (len < 1) {
return;
}
u8* binary = binary_raw;
size_t i;
printf("%lu: Binary", IZ_AppGetTicks(app));
for (i = 0; i < len; i += 1) {
printf("%c%02x", i == 0 ? '(' : ' ', binary[i]);
char binary_string[len * 3 + 1];
IZ_memset(binary_string, 0, len * 3 + 1);
sprintf(binary_string, "%02x", binary[0]);
for (i = 1; i < len; i += 1) {
sprintf(binary_string, "%s %02x", binary_string, binary[i]);
}
printf(")\n");
IZ_LogInfo(IZ_LOG_CATEGORY_INPUT, "net/ws", "Received binary(length: %d): %s", len, binary_string);
}

void IZ_AppHandleNetworkingInboundTextEvents(struct IZ_App* app, const char* text, size_t len) {
printf("%lu: String(%s)\n", IZ_AppGetTicks(app), text);
IZ_LogInfo(IZ_LOG_CATEGORY_INPUT, "net/ws", "Received string(length: %d): %s", len, text);
}

void IZ_AppHandleOutboundNetworking(struct IZ_App* app) {


+ 1
- 1
src/packages/game/data/IZ_list.c View File

@@ -57,7 +57,7 @@ void IZ_ListPrintNodeValues(IZ_List* list) {
u64 index = 0;
printf("\nlist@%p\n", list);
do {
printf(" %lu@%p:%u\n", index, *list->iterator, *((unsigned int*)(*list->iterator)->value));
printf(" %llu@%p:%u\n", index, *list->iterator, *((unsigned int*)(*list->iterator)->value));
index += 1;
list->iterator = &(*list->iterator)->next;
} while (*list->iterator);


Loading…
Cancel
Save