Created
June 22, 2020 08:58
-
-
Save ahbou/87a21d5c514cd2f218fed6d4af0fcc55 to your computer and use it in GitHub Desktop.
Swift logger with emoji
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
// | |
// Log.swift | |
// | |
// | |
import Foundation | |
class Log { | |
class func msg(message: String, | |
functionName: String = #function, fileNameWithPath: NSString = #file, lineNumber: Int = #line ) { | |
#if DEBUG | |
let output = "⭐️ \(NSDate()) [\(fileNameWithPath.lastPathComponent), \(functionName), line \(lineNumber)] \(message)" | |
print(output) | |
#endif | |
} | |
class func error(error: String, | |
functionName: String = #function, fileNameWithPath: String = #file, lineNumber: Int = #line ) { | |
#if DEBUG | |
let output = "💥 \(NSDate()) [\(functionName), line \(lineNumber)] \(error)" | |
print(output) | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment