ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
apple.c File Reference

Apple unified logging (os_log) integration. More...

Go to the source code of this file.

Macros

#define APPLE_LOG_SUBSYSTEM   "com.ascii-chat"
 
#define APPLE_LOG_CATEGORY   "default"
 

Functions

void platform_log_hook (log_level_t level, const char *message)
 

Detailed Description

Apple unified logging (os_log) integration.

Routes ascii-chat log messages to Apple's unified logging system via os_log. Messages appear in Console.app and are queryable with the log CLI tool:

log stream –predicate 'subsystem == "chat.ascii.ascii-chat"' –level debug

Definition in file apple.c.

Macro Definition Documentation

◆ APPLE_LOG_CATEGORY

#define APPLE_LOG_CATEGORY   "default"

Definition at line 18 of file apple.c.

◆ APPLE_LOG_SUBSYSTEM

#define APPLE_LOG_SUBSYSTEM   "com.ascii-chat"

Definition at line 17 of file apple.c.

Function Documentation

◆ platform_log_hook()

void platform_log_hook ( log_level_t  level,
const char *  message 
)

Definition at line 52 of file apple.c.

52 {
53 if (!message) {
54 return;
55 }
56
57 os_log_t log = get_apple_log();
58
59 // Strip ANSI escape codes for clean system log output
60 char clean[4096];
61 strip_ansi_codes(message, clean, sizeof(clean));
62
63 os_log_with_type(log, level_to_os_log_type(level), "%{public}s", clean);
64}
void strip_ansi_codes(const char *input, char *output, size_t output_size)
Strip ANSI escape codes from a string.

References strip_ansi_codes().