-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSTLogLevel.swift
More file actions
60 lines (53 loc) · 1.46 KB
/
Copy pathSTLogLevel.swift
File metadata and controls
60 lines (53 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// STLogLevel.swift
// STBaseProject
//
// Created by 寒江孤影 on 2018/10/10.
//
import UIKit
public enum STLogLevel: String, CaseIterable, Codable, Sendable, Comparable {
case debug = "DEBUG"
case info = "INFO"
case warning = "WARNING"
case error = "ERROR"
case fatal = "FATAL"
public static func < (lhs: STLogLevel, rhs: STLogLevel) -> Bool {
lhs.priority < rhs.priority
}
public var priority: Int {
switch self {
case .debug: return 0
case .info: return 1
case .warning: return 2
case .error: return 3
case .fatal: return 4
}
}
public var color: UIColor {
switch self {
case .debug: return .systemBlue
case .info: return .systemGreen
case .warning: return .systemOrange
case .error: return .systemRed
case .fatal: return .systemPink
}
}
public var icon: String {
switch self {
case .debug: return "🔍"
case .info: return "ℹ️"
case .warning: return "⚠️"
case .error: return "❌"
case .fatal: return "💥"
}
}
public var systemImageName: String {
switch self {
case .debug: return "ladybug"
case .info: return "info.circle"
case .warning: return "exclamationmark.triangle"
case .error: return "xmark.octagon"
case .fatal: return "bolt.trianglebadge.exclamationmark"
}
}
}