diff seobeo/seobeo.h @ 96:70401cf61e97

[Seobeo] Added logging.
author June Park <parkjune1995@gmail.com>
date Fri, 02 Jan 2026 19:16:17 -0800
parents 5710108c949e
children c39582f937e5
line wrap: on
line diff
--- a/seobeo/seobeo.h	Fri Jan 02 19:11:35 2026 -0800
+++ b/seobeo/seobeo.h	Fri Jan 02 19:16:17 2026 -0800
@@ -8,13 +8,13 @@
  * Library for starting TCP, UDP server and serving static file or path.
  */
 
-// Define DIRECTORY before any includes to enable directory operations in dowa.h
-#ifndef DIRECTORY
-#define DIRECTORY
-#endif
+#include "seobeo/seobeo_internal.h"
 
-#include <stdio.h>
-#include <stdlib.h>
+/* Included in dowa
+  #include <stdio.h>
+  #include <stdlib.h>
+*/
+#include <stdarg.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
@@ -27,10 +27,7 @@
 #include <signal.h>
 #include <fcntl.h>
 #include <pthread.h>
-#include <stdatomic.h>
-#include <stdbool.h>
 
-#include "seobeo/seobeo_internal.h"
 
 #define INITIAL_BUFFER_CAPACITY 4096
 
@@ -73,8 +70,6 @@
 extern int            Seobeo_Web_Server_Start(const char *folder_path, const char *port, Seobeo_ServerMode mode, int thread_count);
 /* Generic HTTP GET Rquest to given host and port with path. It will mimic chrome. */
 extern int            Seobeo_Web_Client_Get(const char *host, const char *port, const char *path);
-
-// --- Router --- //
 /* Initialize the router system (called automatically by Seobeo_Web_Server_Start) */
 extern void           Seobeo_Router_Init();
 /* Register an API route handler. Call before starting server. */
@@ -99,5 +94,13 @@
 /* Move to read_buffer to front and we already consumed the given amount in the handle. */
 extern void           Seobeo_Handle_Consume(Seobeo_Handle *p_handle, uint32 consumed);
 /* Assign IP4 or IP6 to sockaddr. TODO: Maybe create my own struct for this? */
-extern void           *Seobeo_Get_IP4_Or_IP6(struct sockaddr *sa);
+extern void          *Seobeo_Get_IP4_Or_IP6(struct sockaddr *sa);
+/* Logging */
+typedef enum {
+  SEOBEO_INFO = 0,
+  SEOBEO_WARNING,
+  SEOBEO_ERROR,
+  SEOBEO_DEBUG,
+} Seobeo_Log_Level;
+extern int            Seobeo_Log(Seobeo_Log_Level level, const char *format, ...);
 #endif