aboutsummaryrefslogtreecommitdiff
path: root/chatty.h
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-04-27 12:52:06 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-04-27 13:05:34 +0200
commitf87f7b4f0aaccc65d03ccee5bb11915ead6fb0e1 (patch)
treed54df0bfde3dbffa02b1f138af4f12456f261e54 /chatty.h
parent0574f5a7c5159a2ae1d7d2182cec982509947db9 (diff)
First pass at preparing for Github
Diffstat (limited to 'chatty.h')
-rw-r--r--chatty.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/chatty.h b/chatty.h
deleted file mode 100644
index 5891b94..0000000
--- a/chatty.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef CHATTY_H
-#define CHATTY_H
-
-#include <assert.h>
-#include <locale.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <time.h>
-#include <unistd.h>
-#include <wchar.h>
-
-// port for chatty
-#define PORT 9983
-// max number of bytes that can be logged at once
-#define LOGMESSAGE_MAX 2048
-#define LOG_FMT "%H:%M:%S "
-#define LOG_LEN 10
-// Enable/Disable saving clients permanently to file
-// #define IMPORT_ID
-
-#define Kilobytes(Value) ((Value) * 1024)
-#define Megabytes(Value) (Kilobytes(Value) * 1024)
-#define Gigabytes(Value) (Megabytes((u64)Value) * 1024)
-#define Terabytes(Value) (Gigabytes((u64)Value) * 1024)
-#define PAGESIZE 4096
-#define local_persist static
-#define global_variable
-#define internal static
-
-#include "types.h"
-
-void Loggingf(char* format, ...);
-
-#endif // CHATTY_H
-
-#ifdef CHATTY_IMPL
-
-global_variable s32 LogFD;
-
-void
-LoggingF(char* format, ...)
-{
- char buf[LOGMESSAGE_MAX];
- va_list args;
- va_start(args, format);
-
- vsnprintf(buf, sizeof(buf), format, args);
- va_end(args);
-
- int n = 0;
- while (*(buf + n) != 0) n++;
-
- u64 t = time(0);
- u8 timestamp[LOG_LEN];
- struct tm* ltime = localtime((time_t*)&t);
- strftime((char*)timestamp, LOG_LEN, LOG_FMT, ltime);
- write(LogFD, timestamp, LOG_LEN - 1);
-
- write(LogFD, buf, n);
-}
-
-
-#endif // CHATTY_IMPL