|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
📝 Multi-level logging with terminal color support, file rotation, and async output More...
Go to the source code of this file.
Data Structures | |
| struct | log_context_t |
Macros | |
| #define | LOG_COLOR_COUNT 7 /* DEV, DEBUG, INFO, WARN, ERROR, FATAL, RESET */ |
| #define | LOGGING_INTERNAL_ERROR(error, message, ...) |
Enumerations | |
| enum | log_color_mode_t { LOG_CMODE_16 = 0 , LOG_CMODE_256 = 1 , LOG_CMODE_TRUECOLOR = 2 , LOG_CMODE_COUNT = 3 } |
Functions | |
| size_t | get_current_time_formatted (char *time_buf) |
| Get current time as formatted string. | |
| char * | format_message (const char *format, va_list args) |
| Format a message using va_list. | |
| void | log_init (const char *filename, log_level_t level, bool force_stderr, bool use_mmap) |
| Initialize the logging system. | |
| void | log_destroy (void) |
| Destroy the logging system and close log file. | |
| void | log_set_level (log_level_t level) |
| Set the minimum log level. | |
| log_level_t | log_get_level (void) |
| Get the current minimum log level. | |
| void | log_set_terminal_output (bool enabled) |
| Control stderr output to terminal. | |
| bool | log_get_terminal_output (void) |
| Get current terminal output setting. | |
| void | log_set_force_stderr (bool enabled) |
| Force all terminal log output to stderr. | |
| bool | log_get_force_stderr (void) |
| Get current force_stderr setting. | |
| bool | log_lock_terminal (void) |
| Lock terminal output for exclusive access by the calling thread. | |
| void | log_unlock_terminal (bool previous_state) |
| Release terminal lock and flush buffered messages. | |
| void | log_set_flush_delay (unsigned int delay_ms) |
| Set the delay between flushing buffered log entries. | |
| void | log_truncate_if_large (void) |
| Manually truncate large log files. | |
| void | log_msg (log_level_t level, const char *file, int line, const char *func, const char *fmt,...) |
| Log a message at a specific level. | |
| void | log_plain_msg (const char *fmt,...) |
| Plain logging without timestamps or levels. | |
| void | log_plain_stderr_msg (const char *fmt,...) |
| Plain logging to stderr with newline. | |
| void | log_plain_stderr_nonewline_msg (const char *fmt,...) |
| Plain logging to stderr without trailing newline. | |
| void | log_file_msg (const char *fmt,...) |
| Log to file only, no stderr output. | |
| asciichat_error_t | log_network_message (socket_t sockfd, const struct crypto_context_t *crypto_ctx, log_level_t level, remote_log_direction_t direction, const char *fmt,...) |
| Send a formatted log message over the network. | |
| asciichat_error_t | log_net_message (socket_t sockfd, const struct crypto_context_t *crypto_ctx, log_level_t level, remote_log_direction_t direction, const char *file, int line, const char *func, const char *fmt,...) |
| Log a message to all destinations (network, file, and terminal). | |
| void | log_redetect_terminal_capabilities (void) |
| Re-detect terminal capabilities after logging is initialized. | |
| const char ** | log_get_color_array (void) |
| Get the appropriate color array based on terminal capabilities. | |
| const char * | log_level_color (log_color_t color) |
| Get color string for a given color enum. | |
| asciichat_error_t | log_enable_mmap (const char *log_path) |
| Enable lock-free mmap-based logging. | |
| asciichat_error_t | log_enable_mmap_sized (const char *log_path, size_t max_size) |
| Enable lock-free mmap logging with custom file size. | |
| void | log_disable_mmap (void) |
| Disable mmap logging and return to mutex-based logging. | |
| void | log_shutdown_begin (void) |
| Begin shutdown phase - disable console logging but keep file logging. | |
| void | log_shutdown_end (void) |
| End shutdown phase - restore previous logging settings. | |
📝 Multi-level logging with terminal color support, file rotation, and async output
Definition in file log/logging.c.
| #define LOG_COLOR_COUNT 7 /* DEV, DEBUG, INFO, WARN, ERROR, FATAL, RESET */ |
Definition at line 77 of file log/logging.c.
| #define LOGGING_INTERNAL_ERROR | ( | error, | |
| message, | |||
| ... | |||
| ) |
Definition at line 104 of file log/logging.c.
| enum log_color_mode_t |
| Enumerator | |
|---|---|
| LOG_CMODE_16 | |
| LOG_CMODE_256 | |
| LOG_CMODE_TRUECOLOR | |
| LOG_CMODE_COUNT | |
Definition at line 75 of file log/logging.c.