간단히 프로젝트 만들어서, 디버그하거나 내부동작을 볼 때 사용하면 좋다. 시간 재기에 좋다.

func printMore(_ items: Any..., function: String = #function, file: String = #file, line: Int = #line, separator: String = " ", terminator: String = "\\n") {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "hh:mm:ss.SSS"
    let dateString = dateFormatter.string(from: Date())
    let items = items.map { "\\($0)" }.joined(separator: separator)
    let filename = file.components(separatedBy: "/").last?.components(separatedBy: ".").first ?? ""
    
    Swift.print(dateString, "\\(filename):\\(line)", function, items, terminator: terminator)
}

더 심각한 로그는 여길 더 알아보자.

https://github.com/apple/swift-log

https://developer.apple.com/documentation/os/logging

https://developer.apple.com/documentation/os/logger