ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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 LOG_APPLE_CLEAN_BUFFER_SIZE   4096
#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 21 of file apple.c.

◆ APPLE_LOG_SUBSYSTEM

#define APPLE_LOG_SUBSYSTEM   "com.ascii-chat"

Definition at line 20 of file apple.c.

◆ LOG_APPLE_CLEAN_BUFFER_SIZE

#define LOG_APPLE_CLEAN_BUFFER_SIZE   4096

Definition at line 13 of file apple.c.

Referenced by platform_log_hook().

Function Documentation

◆ platform_log_hook()

void platform_log_hook ( log_level_t level,
const char * message )

Definition at line 55 of file apple.c.

55 {
56 if (!message) {
57 return;
58 }
59
60 os_log_t log = get_apple_log();
61
62 // Strip ANSI escape codes for clean system log output
64 strip_ansi_codes(message, clean, sizeof(clean));
65
66 os_log_with_type(log, level_to_os_log_type(level), "%{public}s", clean);
67}
#define LOG_APPLE_CLEAN_BUFFER_SIZE
Definition apple.c:13
void strip_ansi_codes(const char *input, char *output, size_t output_size)
Strip ANSI escape codes from a string.
Definition string.c:374

References LOG_APPLE_CLEAN_BUFFER_SIZE, and strip_ansi_codes().