Skip to content

Instantly share code, notes, and snippets.

@ahbou
Created June 22, 2020 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahbou/87a21d5c514cd2f218fed6d4af0fcc55 to your computer and use it in GitHub Desktop.
Save ahbou/87a21d5c514cd2f218fed6d4af0fcc55 to your computer and use it in GitHub Desktop.
Swift logger with emoji
//
// 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