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"])
我想設(shè)置成文章中的Xcode輸出樣式。 但是github中我沒有找到樣式的設(shè)置。 他只告訴怎么用。 難道我需要換其他的庫么