OSLogPrivacy
The privacy options that determine when to redact or display values in log messages.
Declaration
@frozen struct OSLogPrivacyOverview
The OSLogPrivacy structure determines the visibility of interpolated values in log messages. Because people have access to log messages that your app generates, use the privacy options to hide potentially sensitive information. For example, you might use it to hide account information or personal data.
Use the available properties and methods to fetch an appropriately configured version of this structure, and pass it with your interpolated value in the log message. The following example shows how to mark a variable that contains the user’s bank account information as private:
Logger().info("User bank account number: \(accountNumber, privacy: .private)")When you want to replace the generic redaction string with a hashed version of the original value, specify privacy options using the auto(mask:), private(mask:), and sensitive(mask:) methods. Using a hash string makes it possible to correlate log messages that contain the same original value, which helps you protect the user’s privacy and still diagnose issues surrounding a specific value.