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
‘sseverity
to the correspondingOSLogType
value.This value strikes a sensible balance between the higher-overhead logging provided by
.strict
and the more ephemeral logging of.relaxed
.LogSeverity OSLogType .verbose
.debug
.debug
.debug
.info
.info
.warning
.default
.error
.error
Declaration
Swift
case `default`
-
A strict translation from a
LogEntry
‘sseverity
to anOSLogType
value. 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
.fault
Declaration
Swift
case strict
-
A relaxed translation from a
LogEntry
‘sseverity
to anOSLogType
value. 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
.default
Declaration
Swift
case relaxed
-
OSLogType.default
is used for all messages.Declaration
Swift
case allAsDefault
-
OSLogType.info
is used for all messages.Declaration
Swift
case allAsInfo
-
OSLogType.debug
is used for all messages.Declaration
Swift
case allAsDebug