Created
June 5, 2018 09:06
-
-
Save anthonyvitocuaderno/30d648a63755201f7f66a177c1a8f0d5 to your computer and use it in GitHub Desktop.
Pretty print for Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func printV( _ message:Any..., file:String = #file, function:String = #function, line:Int = #line) { | |
let type = Constants.logs.v | |
if !type.status { | |
return | |
} | |
if let f = file.split(separator: "/").last { | |
print("<<<\(type.symbol) \(f) Line - \(line)", "\(function) says:", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} else { | |
print("<<<\(type.symbol) \(file) \(function)", "Line: \(line)", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} | |
} | |
public func printD( _ message:Any..., file:String = #file, function:String = #function, line:Int = #line) { | |
let type = Constants.logs.d | |
if !type.status { | |
return | |
} | |
if let f = file.split(separator: "/").last { | |
print("<<<\(type.symbol) \(f) Line - \(line)", "\(function) says:", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} else { | |
print("<<<\(type.symbol) \(file) \(function)", "Line: \(line)", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} | |
} | |
public func printW( _ message:Any..., file:String = #file, function:String = #function, line:Int = #line) { | |
let type = Constants.logs.w | |
if !type.status { | |
return | |
} | |
if let f = file.split(separator: "/").last { | |
print("<<<\(type.symbol) \(f) Line - \(line)", "\(function) says:", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} else { | |
print("<<<\(type.symbol) \(file) \(function)", "Line: \(line)", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} | |
} | |
public func printE( _ message:Any..., file:String = #file, function:String = #function, line:Int = #line) { | |
let type = Constants.logs.e | |
if !type.status { | |
return | |
} | |
if let f = file.split(separator: "/").last { | |
print("<<<\(type.symbol) \(f) Line - \(line)", "\(function) says:", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} else { | |
print("<<<\(type.symbol) \(file) \(function)", "Line: \(line)", message, "\(DateUtil.convert(date: DateUtil.convert(toSgDateFormat: Date())))") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment