Skip to content

Commit

Permalink
feat: add better print flags
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed May 6, 2021
1 parent 3138324 commit 413fbf9
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Sources/ExtensionKit/Foundation/Global.swift
Expand Up @@ -23,8 +23,28 @@ public func sleep(duration: TimeInterval) {
/// to optimaze the performance.
///
/// - Parameter item: items to print
public func dprint(_ item: @autoclosure () -> Any) {
public func dprint(_ item: @autoclosure () -> Any, _ event: PrintEvent = .d) {
#if DEBUG
print(item())
print("\(event.rawValue): \(item())")
#endif
}

/// Print event type
public enum PrintEvent: String {
/// Error
case e = "[‼️]" // error
/// Info
case i = "[ℹ️]" // info
/// Debug
case d = "[💬]" // debug
/// Verbose
case v = "[🔬]" // verbose
/// Warning
case w = "[⚠️]" // warning

var value: String {
get {
return self.rawValue;
}
}
}

0 comments on commit 413fbf9

Please sign in to comment.