#include <os/log.h>

os/log.h Kernel.framework

includes: os/object.h, Kernel/stdint.h, Kernel/stdbool.h
11 macros · 11 functions · 2 variables · 2 typedefs · 1 enum

macroOS_LOG_NOTAILCALL

#define OS_LOG_NOTAILCALL __attribute__((not_tail_called))

macroOS_LOG_NOTAILCALL_MARKER

#define OS_LOG_NOTAILCALL_MARKER 

variable__dso_handle

extern void *__dso_handle

macroOS_LOG_BUFFER_MAX_SIZE

#define OS_LOG_BUFFER_MAX_SIZE 256

macroOS_LOG_DATA_MAX_SIZE

The OS_LOG_BUFFER_MAX_SIZE limit includes the metadata that must be included in the os_log firehose buffer
#define OS_LOG_DATA_MAX_SIZE (OS_LOG_BUFFER_MAX_SIZE - 16)

function_os_log_verify_format_str

__osloglike(1, 2)
OS_ALWAYS_INLINE static inline void _os_log_verify_format_str(
	__unused const char *msg,
	...
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libkern/os/log.h
Empty inline placeholder whose os_log-style format attribute lets the compiler type-check the format string and arguments of the os_log family of macros. The macros invoke it inside an if (0) branch, so it is never executed; it exists solely to surface format/argument mismatches at compile time.

function_os_log_verify_format_str

OS_ALWAYS_INLINE static inline void _os_log_verify_format_str(
	/* placeholder */
	__unused const char *msg,
	...
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu libkern/os/log.h
Empty inline placeholder whose os_log-style format attribute lets the compiler type-check the format string and arguments of the os_log family of macros. The macros invoke it inside an if (0) branch, so it is never executed; it exists solely to surface format/argument mismatches at compile time.

typedefos_log_t

typedef struct os_log_s *os_log_t

macroOS_LOG_DISABLED

@const OS_LOG_DISABLED @discussion Use this to disable a specific log message.
#define OS_LOG_DISABLED NULL

variable_os_log_default

OS_EXPORT struct os_log_s _os_log_default

functionos_log_create

OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_OBJECT_RETURNS_RETAINED os_log_t os_log_create(
	const char *subsystem,
	const char *category
)
@function os_log_create @abstract Creates a log object to be used with other log related functions. @discussion Creates a log object to be used with other log related functions. The log object serves two purposes: (1) tag related messages by subsystem and category name for easy filtering, and (2) control logging system behavior for messages. @param subsystem The identifier of the given subsystem should be in reverse DNS form (i.e., com.company.mysubsystem). This string must be a constant string, not dynamically generated. @param category The category within the given subsystem that specifies the settings for the log object. This string must be a constant string, not dynamically generated. @result Returns an os_log_t value to be passed to other os_log API calls. This should be called once at log initialization and rely on system to detect changes to settings. A value will always be returned to allow for dynamic enablement.

functionos_log_info_enabled

OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_log_info_enabled(os_log_t log)
@function os_log_info_enabled @abstract Returns if additional information log messages are enabled for a particular log object. @discussion Returns if additional information log messages are enabled for a particular log object. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @result Returns ‘true’ if additional information log messages are enabled.

functionos_log_debug_enabled

OS_EXPORT OS_NOTHROW OS_WARN_RESULT bool os_log_debug_enabled(os_log_t log)
@function os_log_debug_enabled @abstract Returns if debug log messages are enabled for a particular log object. @discussion Returns if debug log messages are enabled for a particular log object. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @result Returns ‘true’ if debug log messages are enabled.

macroos_log_debug

@function os_log_debug @abstract Insert a debug log message into the Unified Logging and Tracing system. @discussion Insert a debug log message into the Unified Logging and Tracing system in accordance with the preferences specified by the provided log object. When an os_activity_id_t is present, the log message will also be scoped by that identifier. Activities provide granular filtering of log messages across threads and processes. There is a physical cap of 256 bytes per entry for dynamic content, i.e., %s and %@, that can be written to the persistence store. As such, all content exceeding the limit will be truncated before written to disk. Live streams will continue to show the full content. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @param format A format string to generate a human-readable log message when the log line is decoded. This string must be a constant string, not dynamically generated. Supports all standard printf types and %@ (objects).
#define os_log_debug(log, format, ...) os_log_with_type(log, OS_LOG_TYPE_DEBUG, format, ##__VA_ARGS__)

macroos_log_error

@function os_log_error @abstract Insert an error log message into the Unified Logging and Tracing system. @discussion Insert an error log message into the Unified Logging and Tracing system. When an os_activity_id_t is present, the log message will also be scoped by that identifier. Activities provide granular filtering of log messages across threads and processes. There is a physical cap of 256 bytes per entry for dynamic content, i.e., %s and %@, that can be written to the persistence store. As such, all content exceeding the limit will be truncated before written to disk. Live streams will continue to show the full content. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @param format A format string to generate a human-readable log message when the log line is decoded. This string must be a constant string, not dynamically generated. Supports all standard printf types and %@ (objects).
#define os_log_error(log, format, ...) os_log_with_type(log, OS_LOG_TYPE_ERROR, format, ##__VA_ARGS__)

macroos_log_fault

@function os_log_fault @abstract Insert a fault log message into the Unified Logging and Tracing system. @discussion Log a fault message issue into the Unified Logging and Tracing system signifying a multi-process (i.e., system error) related issue, either due to interaction via IPC or some other. Faults will gather information from the entire process chain and record it for later inspection. When an os_activity_id_t is present, the log message will also be scoped by that identifier. Activities provide granular filtering of log messages across threads and processes. There is a physical cap of 256 bytes per entry for dynamic content, i.e., %s and %@, that can be written to the persistence store. As such, all content exceeding the limit will be truncated before written to disk. Live streams will continue to show the full content. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @param format A format string to generate a human-readable log message when the log line is decoded. This string must be a constant string, not dynamically generated. Supports all standard printf types and %@ (objects).
#define os_log_fault(log, format, ...) os_log_with_type(log, OS_LOG_TYPE_FAULT, format, ##__VA_ARGS__)

macroos_log_with_type

@function os_log_with_type @abstract Log a message using a specific type. @discussion Will log a message with the provided os_log_type_t. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @param type Pass a valid type from os_log_type_t. @param format A format string to generate a human-readable log message when the log line is decoded. This string must be a constant string, not dynamically generated. Supports all standard printf types and %@ (objects).
#define os_log_with_type(log, type, format, ...) __extension__({
    _Static_assert(__builtin_constant_p(format), "format string must be constant");
    __attribute__((section("__TEXT,__os_log"))) static const char _os_log_fmt[] = format;
    if (0) {
	_os_log_verify_format_str(format, ##__VA_ARGS__);
    } else {
	_os_log_internal(&__dso_handle, log, type, _os_log_fmt, ##__VA_ARGS__);
    }
    __asm__(""); /* avoid tailcall */
})

macroos_log_at_time

@function os_log_at_time @abstract Log a message using a specific type and a timestamp. @discussion Will log a message with the provided os_log_type_t and a timestamp signifying a moment of a log message creation. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @param type Pass a valid type from os_log_type_t. @param ts Pass a uint64_t value (timestamp) of mach continuous time clock. @param format A format string to generate a human-readable log message when the log line is decoded. This string must be a constant string, not dynamically generated. Supports all standard printf types.
#define os_log_at_time(log, type, ts, format, ...) __extension__({
    _Static_assert(__builtin_constant_p(format), "format string must be constant");
    __attribute__((section("__TEXT,__os_log"))) static const char _os_log_fmt[] = format;
    if (0) {
	_os_log_verify_format_str(format, ##__VA_ARGS__);
    } else {
	_os_log_at_time(&__dso_handle, log, type, ts, _os_log_fmt, ##__VA_ARGS__);
    }
    __asm__(""); /* avoid tailcall */
})

macroos_log_driverKit

@function os_log_driverKit @abstract Log a message using a specific type. This variant should be called only from dexts. @discussion Will log a message with the provided os_log_type_t. @param log Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. @param type Pass a valid type from os_log_type_t. @param format A format string to generate a human-readable log message when the log line is decoded. This string must be a constant string, not dynamically generated. Supports all standard printf types and %@ (objects). @result Returns EPERM if the caller is not a driverKit process, 0 in case of success.
#define os_log_driverKit(out, log, type, format, ...) __extension__({
    _Static_assert(__builtin_constant_p(format), "format string must be constant");
    __attribute__((section("__TEXT,__os_log"))) static const char _os_log_fmt[] = format;
    if (0) {
	_os_log_verify_format_str(format, ##__VA_ARGS__);
    } else {
	(*(out)) = _os_log_internal_driverKit(&__dso_handle, log, type, _os_log_fmt, ##__VA_ARGS__);
    }
    __asm__(""); /* avoid tailcall */
})

functionos_log_coprocessor

bool os_log_coprocessor(
	void *buff,
	uint64_t buff_len,
	os_log_type_t type,
	const char *uuid,
	uint64_t timestamp,
	uint32_t offset,
	bool stream_log
)
@function os_log_coprocessor @abstract IOP logging function, intended for use by RTBuddy for coprocessor os log functionality only.

functionos_log_coprocessor_register

void os_log_coprocessor_register(const char *uuid, const char *file_path, bool copy)
@function os_log_coprocessor_register @abstract IOP metadata registration, intended for use by RTBuddy for coprocessor os log functionality only. Will be removed after all user code will be updated to use os_log_coprocessor_register_with_type.

enumos_log_coproc_reg_t

underlying type unsigned int
os_log_coproc_register_memory0
os_log_coproc_register_harvest_fs_ftab1

typedefos_log_coproc_reg_t

typedef enum os_log_coproc_reg_t os_log_coproc_reg_t;

functionos_log_coprocessor_register_with_type

void os_log_coprocessor_register_with_type(
	const char *uuid,
	const char *file_path,
	os_log_coproc_reg_t register_type
)
@function os_log_coprocessor_register_with_type @abstract IOP metadata registration, intended for use by RTBuddy for coprocessor os log functionality only.

function_os_log_internal

__osloglike(4, 5)
OS_EXPORT OS_NOTHROW void _os_log_internal(
	void *dso,
	os_log_t log,
	os_log_type_t type,
	const char *message,
	...
)
@function _os_log_internal @abstract Internal function used by macros.

function_os_log_internal_driverKit

__osloglike(4, 5)
OS_EXPORT OS_NOTHROW int _os_log_internal_driverKit(
	void *dso,
	os_log_t log,
	os_log_type_t type,
	const char *message,
	...
)
@function _os_log_internal_driverKit @abstract Internal function used by macros.

function_os_log_at_time

__osloglike(5, 6)
OS_EXPORT OS_NOTHROW void _os_log_at_time(
	void *dso,
	os_log_t log,
	os_log_type_t type,
	uint64_t ts,
	const char *message,
	...
)
@function _os_log_internal_props @abstract Internal function used by macros.