<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "os",
  "identifier" : "/documentation/os/os_log(_:dso:log:type:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "os"
    ],
    "preciseIdentifier" : "s:2os0A4_log_3dso0B04type_ys12StaticStringV_SVSgSo03OS_a1_B0CSo0a1_b1_D2_tas7CVarArg_pdtF"
  },
  "title" : "os_log(_:dso:log:type:_:)"
}
-->

# os_log(_:dso:log:type:_:)

Sends a message to the logging system, optionally specifying a custom log object, log level, and any message format arguments.

```
func os_log(_ message: StaticString, dso: UnsafeRawPointer? = #dsohandle, log: OSLog = .default, type: OSLogType = .default, _ args: any CVarArg...)
```

## Parameters

`message`

A constant string or format string that produces a human-readable log message.

`log`

A custom log object. If unspecified, system uses the shared default log.

`type`

The log level. If unspecified, the system uses the default log level.

`args`

If `message` is a constant string, do not specify arguments.

    If     `message`     is a format string, pass the expected number of arguments in the order that they appear in the string.

## Discussion

Call this function to capture information about things that might result in a failure. For more information about format strings, see [String Format Specifiers](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFStrings/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265).

---

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)