Contents

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

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.

See Also

Log Messages