Skip to content

Commit 153b703

Browse files
freakboy3742miss-islington
authored andcommitted
gh-150644: Tag Apple system log messages as public. (GH-150645)
macOS 26 changed the default visibility of "dynamic" system messages. This changes the logging strategy to tag all messages as "public" so they are visible in the system log without special configuration. (cherry picked from commit 71fc4c6) Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
1 parent a4f3336 commit 153b703

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
When system logging is enabled (with ``config.use_system_logger``, messages
2+
are now tagged as public. This allows the macOS 26 system logger to view
3+
messages without special configuration.

Python/pylifecycle.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3324,7 +3324,9 @@ apple_log_write_impl(PyObject *self, PyObject *args)
33243324

33253325
// Pass the user-provided text through explicit %s formatting
33263326
// to avoid % literals being interpreted as a formatting directive.
3327-
os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
3327+
// Using {public} ensures "dynamic" string messages are visible
3328+
// in the log without special configuration.
3329+
os_log_with_type(OS_LOG_DEFAULT, logtype, "%{public}s", text);
33283330
Py_RETURN_NONE;
33293331
}
33303332

0 commit comments

Comments
 (0)