歡迎加入QQ討論群258996829

Swift 日志框架 XCGLogger

發(fā)布時(shí)間:2016-05-30 23:08  回復(fù):0  查看:6508  感興趣:17  贊:0   最后回復(fù):2016-05-30 23:08  

Swift 日志框架 XCGLogger

XCGLogger是一個debug日志框架,用于Swift項(xiàng)目中。允許您記錄詳細(xì)信息到控制臺(還有一個可選的文件)。就像你用NSLog或println,但還有其他額處信息,如日期,函數(shù)名,文件名和行號。

示例代碼:

import XCGLogger

let log = XCGLogger.defaultInstance()

//配置
log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: "path/to/file", fileLogLevel: .Debug)

log.verbose("A verbose message, usually useful when working on a specific problem")
log.debug("A debug message")
log.info("An info message, probably useful to power users looking in console.app")
log.warning("A warning message, may indicate a possible error")
log.error("An error occurred, but it's recoverable, just info about what happened")
log.severe("A severe error occurred, we are likely about to crash now")

相關(guān)開源代碼

您還未登錄,請先登錄

熱門帖子

最新帖子

?