Skip to content

Commit

Permalink
LogLevel now Comparable. Added colored icons to description of LogLev…
Browse files Browse the repository at this point in the history
…els.
  • Loading branch information
mlilback committed Dec 2, 2017
1 parent a655e44 commit 9c2fb9e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Sources/MJLLogger/LogLevel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Foundation
/// - debug: a message only relevant while debugging
/// - enter: a notice of enter a function
/// - exit: a notice of exiting a function
public enum LogLevel: Int, CustomStringConvertible {
public enum LogLevel: Int, Comparable, CustomStringConvertible {
case error = 1
case warn
case info
Expand All @@ -24,13 +24,15 @@ public enum LogLevel: Int, CustomStringConvertible {

public var description: String {
switch self {
case .error: return "ERROR"
case .warn: return "WARN"
case .info: return "INFO"
case .debug: return "DEBUG"
case .enter: return "ENTER"
case .exit: return "EXIT"
case .error: return "❤️ ERROR"
case .warn: return "💛 WARN"
case .info: return "💜 INFO"
case .debug: return "🖤 DEBUG"
case .enter: return "💙 ENTER"
case .exit: return "💙 EXIT"
}
}

public static func <(lhs: LogLevel, rhs: LogLevel) -> Bool {
return lhs.rawValue < rhs.rawValue
}
}

0 comments on commit 9c2fb9e

Please sign in to comment.