Contents

OSLogInt32ExtendedFormat.darwinErrno

A format that displays a 32-bit integer as a Darwin error number.

Declaration

case darwinErrno

Discussion

Use this option to format the interpolated value as a Darwin error number, such as 32: Broken pipe. The following example applies the darwinErrno formatter to the 32-bit integer value 24:

// Create a logger with the specified subsystem and category.
let logger = Logger(subsystem: "com.example.OSLogValueFormatting",
                    category: "Formatter Output")
                
// Assign the value to interpolate.
let value: Int32 = 24
                
// Write the value to the log using the specified format.
logger.info(".darwinErrno output is \(value, format: .darwinErrno)")

And the system writes the following message to the log:

[Formatter Output] .darwinErrno output is [24: Too many open files]

See Also

Getting the Formats