欢迎加入QQ讨论群258996829

Swift 日志框架 XCGLogger

发布时间:2016-05-30 23:08  回复:0  查看:6566  感兴趣:17  赞:0   最后回复:2016-05-30 23:08  

Swift 日志框架 XCGLogger

XCGLogger是一个debug日志框架,用于Swift项目中。允许您记录详细信息到控制台(还有一个可选的文件)。就像你用NSLog或println,但还有其他额处信息,如日期,函数名,文件名和行号。

示例代码:

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")

相关开源代码

您还未登录,请先登录

热门帖子

最新帖子