我的电子版应用程序的主要流程已经有了大量的console.log语句,有没有办法将所有这些发送到电子日志或其他日志,可以在应用程序打包后访问?我打算通过脚本添加let calendar = Calendar.current
var todayStartDate = Date()
var interval = TimeInterval()
calendar.dateInterval(of: .day, start: &todayStartDate, interval: &interval, for: Date())
let todayEndDate = calendar.date(byAdding: .second, value: Int(interval-1), to: todayStartDate)!
print(todayStartDate)
print(todayEndDate)
,但希望有更好的方法。
log.error
答案 0 :(得分:1)
类似的东西:
console.log = function(){
...your code...
};
可以是个主意吗?