log.swift
func logError(_ logMessage: String, functionName: String = #function, filePath: String = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) {
guard let fileName = NSURL(fileURLWithPath: filePath).lastPathComponent else {
return
}
#if (arch(i386) || arch(x86_64)) && os(iOS)
print("[\(fileName):\(lineNumber)] \(functionName) \(logMessage) \(userInfo)")
#else
var properties = userInfo
properties["Filename"] = fileName
properties["Line number"] = lineNumber
properties["Function name"] = functionName
properties["Log"] = logMessage
mixpanel.track(event: "System Error",
properties: properties)
#endif
}