Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions include/webui.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ typedef struct webui_event_t {
char* cookies; // Client's full cookies
} webui_event_t;

enum webui_logger_level {
WEBUI_LOGGER_LEVEL_DEBUG = 0, // 0. All logs with all details
WEBUI_LOGGER_LEVEL_INFO, // 1. Only general logs
WEBUI_LOGGER_LEVEL_ERROR, // 2. Only fatal error logs
};

// -- Definitions ---------------------

/**
Expand Down Expand Up @@ -916,6 +922,17 @@ WEBUI_EXPORT bool webui_set_port(size_t window, size_t port);
*/
WEBUI_EXPORT size_t webui_get_free_port(void);

/**
* @brief Set a custom logger function.
*
* @example
* void myLogger(size_t level, const char* log, void* user_data) {
* printf("myLogger (%d): %s", level, log);
* }
* webui_set_logger(myLogger, NULL);
*/
WEBUI_EXPORT void webui_set_logger(void (*func)(size_t level, const char* log, void* user_data), void *user_data);

/**
* @brief Control the WebUI behaviour. It's recommended to be called at the beginning.
*
Expand Down
Loading
Loading