5 // Created by Hori,Masaki on 2017/02/12.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
23 func higher(other: Level) -> Bool {
25 return self.rawValue >= other.rawValue
29 private struct Args: CustomStringConvertible, CustomDebugStringConvertible {
34 var description: String {
36 return args.map { "\($0)" }.joined(separator: separator)
39 var debugDescription: String {
42 .map { ($0 as? CustomDebugStringConvertible)?.debugDescription ?? "\($0)" }
43 .joined(separator: separator)
47 class func print(_ items: Any..., separator: String = " ", terminator: String = "\n", level: Level = .debug) {
49 excute(level: level) {
51 Swift.print(Args(args: items, separator: separator), separator: separator, terminator: terminator)
55 class func debugPrint(_ items: Any..., separator: String = " ", terminator: String = "\n", level: Level = .debug) {
57 excute(level: level) {
59 Swift.debugPrint(Args(args: items, separator: separator), separator: separator, terminator: terminator)
63 class func dump<T>(_ value: T, name: String? = nil, indent: Int = 0, maxDepth: Int = Int.max, maxItems: Int = Int.max) -> T {
67 return Swift.dump(value, name: name, indent: indent, maxDepth: maxDepth, maxItems: maxItems)
76 class func excute(level: Level, f: () -> Void) {
78 if UserDefaults.standard[.degugPrintLevel].higher(other: level) {