0

我真的不需要打印到 xcode 控制台的每个日志的日期和时间。我已经尝试过log.dateFormatter = nil了,但这似乎对我没有任何帮助。

4

1 回答 1

1

其 repo的Advanced Usage部分指定了一个参数,showDate,可以设置为false

// Create a logger object with no destinations
let log = XCGLogger(identifier: "advancedLogger", includeDefaultDestinations: false)

// Create a destination for the system console log (via NSLog)
let systemLogDestination = XCGNSLogDestination(owner: log, identifier: "advancedLogger.systemLogDestination")

// Optionally set some configuration options
systemLogDestination.outputLogLevel = .Debug
systemLogDestination.showLogIdentifier = false
systemLogDestination.showFunctionName = true
systemLogDestination.showThreadName = true
systemLogDestination.showLogLevel = true
systemLogDestination.showFileName = true
systemLogDestination.showLineNumber = true
systemLogDestination.showDate = false

// Add the destination to the logger
log.addLogDestination(systemLogDestination)
于 2016-06-29T00:46:42.360 回答