5 // Created by Hori,Masaki on 2017/02/12.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
18 func higher(other: Level) -> Bool {
19 return self.rawValue >= other.rawValue
22 private struct Args: CustomStringConvertible, CustomDebugStringConvertible {
25 var description: String {
26 return args.map { "\($0)" }.joined(separator: separator)
28 var debugDescription: String {
30 .map { ($0 as? CustomDebugStringConvertible)?.debugDescription ?? "\($0)" }
31 .joined(separator: separator)
35 class func print(_ items: Any..., separator: String = " ", terminator: String = "\n", level: Level = .debug) {
36 excute(level: level) {
37 Swift.print(Args(args: items, separator: separator),
39 terminator: terminator)
43 class func debugPrint(_ items: Any..., separator: String = " ", terminator: String = "\n", level: Level = .debug) {
44 excute(level: level) {
45 Swift.debugPrint(Args(args: items, separator: separator),
47 terminator: terminator)
51 class func dump<T>(_ value: T,
54 maxDepth: Int = Int.max,
55 maxItems: Int = Int.max) -> T {
57 return Swift.dump(value, name: name, indent: indent, maxDepth: maxDepth, maxItems: maxItems)
63 class func excute(level: Level, f: () -> Void) {
64 if UserDefaults.standard.degugPrintLevel.higher(other: level) {