Files
ipatool/Source/Logger/LogLevel.swift
T

51 lines
934 B
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// LogLevel.swift
// IPATool
//
// Created by Majd Alfhaily on 22.05.21.
//
import Foundation
import ArgumentParser
enum LogLevel: String, ExpressibleByArgument {
case error
case warning
case info
case debug
}
extension LogLevel {
var prefix: String {
switch self {
case .error:
return "❌\t[Error] "
case .warning:
return "⚠️\t[Warning] "
case .info:
return "ℹ️\t[Info] "
case .debug:
return "🛠\t[Debug] "
}
}
var priority: Int {
switch self {
case .error:
return 0
case .warning:
return 1
case .info:
return 2
case .debug:
return 3
}
}
}
extension LogLevel: Comparable {
static func < (lhs: LogLevel, rhs: LogLevel) -> Bool {
return lhs.priority < rhs.priority
}
}