Created
September 21, 2015 06:09
-
-
Save bishalg/319e68633c74a71860da to your computer and use it in GitHub Desktop.
Debug only Logger for Swift using NSLog
This file contains 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
import Foundation | |
#if DEBUG | |
func dLog(@autoclosure message: () -> String, filename: NSString = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) { | |
NSLog("[\(filename.lastPathComponent):\(line)] \(function) - %@", message()) | |
} | |
#else | |
func dLog(@autoclosure message: () -> String, filename: NSString = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) { | |
} | |
#endif | |
func aLog(message: String, filename: NSString = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) { | |
NSLog("[\(filename.lastPathComponent):\(line)] \(function) - %@", message) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment