Last active
November 13, 2020 10:30
-
-
Save ochim/d0e524e26ffeecf68170b98a1789fea7 to your computer and use it in GitHub Desktop.
swiftのprint()をカスタマイズ
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
func print(_ items: Any..., separator: String = " ", terminator: String = "\n") { | |
#if DEBUG | |
let formatter = DateFormatter() | |
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS" | |
// 文頭に日時を付与する | |
Swift.print(formatter.string(from: Date()), terminator: " ") | |
Swift.print(items, separator: separator, terminator: terminator) | |
#else | |
// なにもしない | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment