OSLogInt32ExtendedFormat.darwinMode
A format that displays a 32-bit integer as a Darwin file mode.
Declaration
case darwinModeDiscussion
Use this option to format the interpolated value as a Darwin file mode, such as -rwx------. Because Darwin uses octal values to represent file modes numerically, pass an octal literal to the formatter. Alternatively, convert the octal value to its 32-bit integer equivalent and interpolate that instead. For more information about using octal literals, see Numeric Literals.
The following example formats the octal literal 0o700 using the darwinMode formatter:
// Create a logger with the specified subsystem and category.
let logger = Logger(subsystem: "com.example.OSLogValueFormatting",
category: "Formatter Output")
// Darwin uses octal values to represent file modes. Use Swift's
// support for octal literals to assign a file mode to a 32-bit
// integer variable.
let value: Int32 = 0o700
// Write the value to the log using the specified format.
logger.info(".darwinMode output is \(value, format: .darwinMode)")And the system writes the following message to the log:
[Formatter Output] .darwinMode formats the value as -rwx------See Also
Getting the Formats
OSLogInt32ExtendedFormat.ipv4AddressOSLogInt32ExtendedFormat.secondsSince1970OSLogInt32ExtendedFormat.darwinErrnoOSLogInt32ExtendedFormat.darwinSignalOSLogInt32ExtendedFormat.bitrateOSLogInt32ExtendedFormat.bitrateIECOSLogInt32ExtendedFormat.byteCountOSLogInt32ExtendedFormat.byteCountIECOSLogInt32ExtendedFormat.truthOSLogInt32ExtendedFormat.answer