---
title: "os_log(_:dso:log:type:_:)"
framework: os
role: symbol
role_heading: Function
path: "os/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.

## Declaration

```swift
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

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.

## See Also

### Log Messages

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