1 /* 2 * Copyright (c) 2015-2022 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24 #ifndef __os_log_private_h 25 #define __os_log_private_h 26 27 #include <os/log.h> 28 #include <firehose/tracepoint_private.h> 29 #include <sys/queue.h> 30 31 #define OS_LOG_MAX_SIZE_ORDER 10 // Maximum log size order (1024 bytes) 32 33 __BEGIN_DECLS 34 35 /*! 36 * @function os_log_with_args 37 * 38 * @abstract 39 * os_log variant that supports va_list args. 40 * 41 * @discussion 42 * os_log variant that supports va_list args. This SPI should only be used 43 * to shim legacy logging systems through os_log. 44 * 45 * @param oslog 46 * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. 47 * 48 * @param type 49 * Pass one of the following message types. 50 * OS_LOG_TYPE_DEFAULT 51 * OS_LOG_TYPE_DEBUG 52 * OS_LOG_TYPE_INFO 53 * OS_LOG_TYPE_ERROR 54 * OS_LOG_TYPE_FAULT 55 * 56 * @param format 57 * A format string to generate a human-readable log message when the log 58 * line is decoded. Supports all standard printf types in addition to %@ 59 * and %m (objects and errno respectively). 60 * 61 * @param args 62 * A va_list containing the values for the format string. 63 * 64 * @param ret_addr 65 * Pass the __builtin_return_address(0) of the function that created the 66 * va_list from variadic arguments. The caller must be the same binary 67 * that generated the message and provided the format string. 68 */ 69 __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) 70 OS_EXPORT OS_NOTHROW OS_LOG_NOTAILCALL 71 void 72 os_log_with_args(os_log_t oslog, os_log_type_t type, const char *format, va_list args, void *ret_addr) __osloglike(3, 0); 73 74 __END_DECLS 75 76 #endif // __os_log_private_h 77