
Swift 2016-05-29 23:28
Swift 日志输出类 SwiftyBeaver
回复:2 查看:10497 感兴趣:89 赞:0
SwiftyBeaver 是 Swift 的一个多彩的、可扩展的、轻量级的日志记录器。
Xcode 控制台输出日志
日志写入文件
示例代码:
import SwiftyBeaver let log = SwiftyBeaver.self // add log destinations. at least one is needed! let console = ConsoleDestination() // log to Xcode Console let file = FileDestination() // log to default swiftybeaver.log file let cloud = SBPlatformDestination(appID: "foo", appSecret: "bar", encryptionKey: "123") // to cloud log.addDestination(console) log.addDestination(file) log.addDestination(cloud) // Now let’s log! log.verbose("not so important") // prio 1, VERBOSE in silver log.debug("something to debug") // prio 2, DEBUG in green log.info("a nice information") // prio 3, INFO in blue log.warning("oh no, that won’t be good") // prio 4, WARNING in yellow log.error("ouch, an error did occur!") // prio 5, ERROR in red // log anything! log.verbose(123) log.info(-123.45678) log.warning(NSDate()) log.error(["I", "like", "logs!"]) log.error(["name": "Mr Beaver", "address": "7 Beaver Lodge"])
相关开源代码
EFIconFont: 一个用 Swift 实现的 IconFont 封装
Swift Zip文件压缩与解压框架
EFResume - 一个普通的 Swift 简历模板
Swift 优雅的定时器及执行工具库 Each
Swift 解析、格式化及验证国际电话号码工具库 PhoneNumberKit
Swift 版 FlatBuffers(跨平台序列化库)FlatBuffersSwift
Swift 编写的 Github API 客户端 Github.swift
Swift OAuth授权库 SwiftyOAuth
Swift 音频处理库 TempiFFT
iOS通知中心封装库SwiftNotificationCenter

leo_kottke 2016-12-15 11:34
我想设置成文章中的Xcode输出样式。 但是github中我没有找到样式的设置。 他只告诉怎么用。 难道我需要换其他的库么

Swift 2016-12-16 10:56
可能是Xocde8不支持输出颜色了吧,所以采用了emoji表情
等替代颜色。
