以前 XCGLogger 对我来说工作得很好,但我决定尝试一些更高级的功能。现在我在 Xcode 的控制台视图中的日志输出填充了:
XCGLogger writing log to: <my logfile name>
它出现在每条记录的消息之前。任何想法为什么?
我对 XCGLogger 的设置:
var log : XCGLogger {
let log = XCGLogger(identifier: "advancedLogger", includeDefaultDestinations: false)
let fileDestination = FileDestination(writeToFile: Constants.file.debugging, identifier: "advancedLogger.fileDestination")
fileDestination.showLogIdentifier = false
fileDestination.showFunctionName = true
fileDestination.showThreadName = false
fileDestination.showLevel = false
fileDestination.showFileName = true
fileDestination.showLineNumber = true
fileDestination.showDate = true
#if DEBUG
fileDestination.outputLevel = .verbose
#else
fileDestination.outputLevel = .debug
// don't log on main thread in production
fileDestination.logQueue = XCGLogger.logQueue
#endif
// Add the destination to the logger
log.add(destination: fileDestination)
return log
}