<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "os",
  "identifier" : "/documentation/os/os_log_with_type",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "os"
    ],
    "preciseIdentifier" : "c:@macro@os_log_with_type"
  },
  "title" : "os_log_with_type"
}
-->

# os_log_with_type

Sends a message at a specific logging level, such as default, info, debug, error, or fault, to the logging system.

```
#define os_log_with_type(log, type, format, ...)
```

## Parameters

`log`

The [`OS_LOG_DEFAULT`](/documentation/os/OS_LOG_DEFAULT) constant or a custom log object previously created by the [`os_log_create`](/documentation/os/os_log_create) function.

`type`

A log type constant, such as [`OS_LOG_TYPE_DEFAULT`](/documentation/os/os_log_type_t/OS_LOG_TYPE_DEFAULT), [`OS_LOG_TYPE_INFO`](/documentation/os/os_log_type_t/OS_LOG_TYPE_INFO), [`OS_LOG_TYPE_DEBUG`](/documentation/os/os_log_type_t/OS_LOG_TYPE_DEBUG), [`OS_LOG_TYPE_ERROR`](/documentation/os/os_log_type_t/OS_LOG_TYPE_ERROR), or [`OS_LOG_TYPE_FAULT`](/documentation/os/os_log_type_t/OS_LOG_TYPE_FAULT), that specifies the level of logging to perform.

`format`

A constant string or format string that produces a human-readable log message. See [String Format Specifiers](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFStrings/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265).

## Discussion

Calling this function doesn’t ensure that the system logs a message. Logging always occurs in accordance with the behavior settings of the provided log object and log type. Note that the logging system may truncate lengthy log messages when it stores them.

## See Also

  <doc://com.apple.documentation/documentation/kernel/os_log_type_t>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)