Contents

OSLogInt32ExtendedFormat.bitrateIEC

A format that displays a 32-bit integer as an IEC bit rate.

Declaration

case bitrateIEC

Discussion

Use this option to format the interpolated value as an IEC bit rate, such as 100 Kibps. The following example applies the bitrateIEC formatter to the 32-bit integer value 102_400:

// 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 = 102_400
                
// Write the value to the log using the specified format.
logger.info(".bitrateIEC output is \(value, format: .bitrateIEC)")

And the system writes the following message to the log:

[Formatter Output] .bitrateIEC output is 100 Kibps

See Also

Getting the Formats