21 lines
428 B
Swift
21 lines
428 B
Swift
//
|
|
// Log.swift
|
|
// App
|
|
//
|
|
// Created by Christoph on 05.05.20.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
private let df: DateFormatter = {
|
|
let df = DateFormatter()
|
|
df.dateStyle = .short
|
|
df.timeStyle = .short
|
|
return df
|
|
}()
|
|
|
|
func log(_ message: String, file: String = #file, line: Int = #line) {
|
|
let date = df.string(from: Date())
|
|
print("[\(date)][\(file.components(separatedBy: "/").last ?? file):\(line)] \(message)")
|
|
}
|