浏览代码

Update logging

Use our log function instead of bare printf calls.
master
父节点
当前提交
48fb8abd6e
共有 2 个文件被更改,包括 11 次插入6 次删除
  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 查看文件

@@ -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 查看文件

@@ -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);


正在加载...
取消
保存