Created
December 29, 2015 22:34
-
-
Save pxpgraphics/a7e25c7673bda9c7d3f4 to your computer and use it in GitHub Desktop.
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
// MARK: PXPLog | |
/** | |
Traditional C-style log with an optional message. | |
Prints file, line and function, by default, followed the messaage, if applicable. | |
- parameter file: The name of the file; defaults to the current localized file. | |
- parameter function: The name of the function; defaults to the function within which the call is made. | |
- parameter line: The line number; defaults to the line number within the file that the call is made. | |
*/ | |
@transparent | |
@inline(__always) | |
public func PXPLog( | |
@autoclosure message: () -> String = String(), | |
file: StaticString = __FILE__, | |
function: StaticString = __FUNCTION__, | |
line: UInt = __LINE__ | |
) { | |
let localizedFile = NSURL(string: String(file))?.lastPathComponent ?? "<Unknown file>" | |
print("\(localizedFile):\(line) #\(function) — \(message())") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample console output: