|
47 | 47 | # include <TargetConditionals.h> |
48 | 48 | # include <mach-o/loader.h> |
49 | 49 | // The os_log unified logging APIs were introduced in macOS 10.12, iOS 10.0, |
50 | | -// tvOS 10.0, and watchOS 3.0; |
| 50 | +// tvOS 10.0, and watchOS 3.0; we enable the use of the system logger |
| 51 | +// automatically on non-macOS platforms. |
51 | 52 | # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE |
52 | | -# define HAS_APPLE_SYSTEM_LOG 1 |
53 | | -# elif defined(TARGET_OS_OSX) && TARGET_OS_OSX |
54 | | -# if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12 |
55 | | -# define HAS_APPLE_SYSTEM_LOG 1 |
56 | | -# else |
57 | | -# define HAS_APPLE_SYSTEM_LOG 0 |
58 | | -# endif |
| 53 | +# define USE_APPLE_SYSTEM_LOG 1 |
59 | 54 | # else |
60 | | -# define HAS_APPLE_SYSTEM_LOG 0 |
| 55 | +# define USE_APPLE_SYSTEM_LOG 0 |
61 | 56 | # endif |
62 | 57 |
|
63 | | -# if HAS_APPLE_SYSTEM_LOG |
| 58 | +# if USE_APPLE_SYSTEM_LOG |
64 | 59 | # include <os/log.h> |
65 | 60 | # endif |
66 | 61 | #endif |
@@ -92,7 +87,7 @@ static PyStatus init_sys_streams(PyThreadState *tstate); |
92 | 87 | #ifdef __ANDROID__ |
93 | 88 | static PyStatus init_android_streams(PyThreadState *tstate); |
94 | 89 | #endif |
95 | | -#if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG |
| 90 | +#if defined(__APPLE__) && USE_APPLE_SYSTEM_LOG |
96 | 91 | static PyStatus init_apple_streams(PyThreadState *tstate); |
97 | 92 | #endif |
98 | 93 | static void wait_for_thread_shutdown(PyThreadState *tstate); |
@@ -1280,12 +1275,10 @@ init_interp_main(PyThreadState *tstate) |
1280 | 1275 | return status; |
1281 | 1276 | } |
1282 | 1277 | #endif |
1283 | | -#if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG |
1284 | | - if (config->use_system_logger) { |
1285 | | - status = init_apple_streams(tstate); |
1286 | | - if (_PyStatus_EXCEPTION(status)) { |
1287 | | - return status; |
1288 | | - } |
| 1278 | +#if defined(__APPLE__) && USE_APPLE_SYSTEM_LOG |
| 1279 | + status = init_apple_streams(tstate); |
| 1280 | + if (_PyStatus_EXCEPTION(status)) { |
| 1281 | + return status; |
1289 | 1282 | } |
1290 | 1283 | #endif |
1291 | 1284 |
|
@@ -2971,7 +2964,7 @@ init_android_streams(PyThreadState *tstate) |
2971 | 2964 |
|
2972 | 2965 | #endif // __ANDROID__ |
2973 | 2966 |
|
2974 | | -#if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG |
| 2967 | +#if defined(__APPLE__) && USE_APPLE_SYSTEM_LOG |
2975 | 2968 |
|
2976 | 2969 | static PyObject * |
2977 | 2970 | apple_log_write_impl(PyObject *self, PyObject *args) |
@@ -3032,7 +3025,7 @@ init_apple_streams(PyThreadState *tstate) |
3032 | 3025 | return status; |
3033 | 3026 | } |
3034 | 3027 |
|
3035 | | -#endif // __APPLE__ && HAS_APPLE_SYSTEM_LOG |
| 3028 | +#endif // __APPLE__ && USE_APPLE_SYSTEM_LOG |
3036 | 3029 |
|
3037 | 3030 |
|
3038 | 3031 | static void |
|
0 commit comments