LogLevel
enum LogLevel
extension LogLevel : Equatable, Hashable, RawRepresentable
Currently we are mimicking the five most common log levels seen in work environments. The LogLevel defines different hierarchical categories that we can use to filter some of the output
-
Error levels should appear when something has gone wrong in some way. This may be either a recoverable or non-recoverable error messaging. Typically these logs should be something that can inform the reader on how they can solve the problem to prevent the error from occurring again.
Declaration
Swift
case error
-
Info, similar to log, has the semantic difference in that what is being stated here is informational and might be something the viewer will want to take into account
Declaration
Swift
case info
-
Creates a new instance with the specified raw value.
If there is no value of the type that corresponds with the specified raw value, this initializer returns
nil
. For example:enum PaperSize: String { case A4, A5, Letter, Legal } print(PaperSize(rawValue: "Legal")) // Prints "Optional("PaperSize.Legal")" print(PaperSize(rawValue: "Tabloid")) // Prints "nil"
Declaration
Swift
init?(rawValue: Int)
-
Log levels are the standard defacto level of logging with only info logging being something that might appear when this does not.
Declaration
Swift
case log
-
Trace logging is only typically enabled when the developers are seeking the most granular and finite information about the stack in question.
Declaration
Swift
case trace
-
Warn levels are when you want to make sure that something is occurring that might be dangerous or lead to unstable behavior
Declaration
Swift
case warn