---
title: "os_log(_:dso:log:_:_:)"
framework: os
role: symbol
role_heading: Function
path: "os/os_log(_:dso:log:_:_:)"
---

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

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

## Declaration

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

## Parameters

- `type`: The log level to assign to the message. For more information about log levels, see doc://com.apple.os/documentation/os/OSLogType.
- `log`: A custom log object. If unspecified, system uses the shared default log.
- `message`: A constant string or format string that produces a human-readable log message.
- `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

Discussion Call this function to capture information about things that might result in a failure. For more information about format strings, see Formatting Log Messages.

## See Also

### Log Messages

- [os_log(_:)](os/os_log(_:).md)
- [os_log(_:log:_:)](os/os_log(_:log:_:).md)
- [os_log(_:dso:log:type:_:)](os/os_log(_:dso:log:type:_:).md)
