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

# os_log(_:log:_:)

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

```
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 [`OSLogType`](/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 [`OSLogMessage`](/documentation/os/OSLogMessage) object. The string may contain interpolated values.

## Discussion

Use this method to capture information at any log level.

---

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)