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

# os_log(_:log:_:)

Adds a new log message using an optional log object and log level.

## Declaration

```swift
func os_log(_ logLevel: OSLogType = .default, log logObject: OSLog = .default, _ message: OSLogMessage)
```

## Parameters

- `logLevel`: The log level to assign to the message. For more information about log levels, see doc://com.apple.os/documentation/os/OSLogType.
- `logObject`: The log object that receives the message. The message inherits the same subsystem and category as the log object.
- `message`: A string containing the message you want to log. Always specify this parameter as a string; this function converts it to an doc://com.apple.os/documentation/os/OSLogMessage object. The string may contain interpolated values.

## Discussion

Discussion Use this method to capture information at any log level.

## See Also

### Log Messages

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