OSLogTypeTranslator
public enum OSLogTypeTranslator
Specifies the manner in which an OSLogType is selected to represent a
given LogEntry.
When a log entry is being recorded by an OSLogRecorder, an OSLogType
value is used to specify the importance of the message; it is similar in
concept to the LogSeverity.
Because there is not an exact one-to-one mapping between OSLogType and
LogSeverity values, OSLogTypeTranslation provides a mechanism for
deriving the appropriate OSLogType for a given LogEntry.
-
The most direct translation from a
LogEntry‘sseverityto the correspondingOSLogTypevalue.This value strikes a sensible balance between the higher-overhead logging provided by
.strictand the more ephemeral logging of.relaxed.LogSeverity OSLogType .verbose.debug.debug.debug.info.info.warning.default.error.errorDeclaration
Swift
case `default`
-
A strict translation from a
LogEntry‘sseverityto anOSLogTypevalue. Warnings are treated as errors; errors are treated as faults.This will result in additional logging overhead being recorded by OSLog, and is not recommended unless you have a specific need for this.
LogSeverity OSLogType .verbose.debug.debug.debug.info.default.warning.error.error.faultDeclaration
Swift
case strict
-
A relaxed translation from a
LogEntry‘sseverityto anOSLogTypevalue. Nothing is treated as an error.This results in low-overhead logging, but log entries are more ephemeral and may not contain as much OSLog metadata.
LogSeverity OSLogType .verbose.debug.debug.debug.info.info.warning.default.error.defaultDeclaration
Swift
case relaxed
-
OSLogType.defaultis used for all messages.Declaration
Swift
case allAsDefault
-
OSLogType.infois used for all messages.Declaration
Swift
case allAsInfo
-
OSLogType.debugis used for all messages.Declaration
Swift
case allAsDebug
View on GitHub
OSLogTypeTranslator Enum Reference