Lithium

Lithium 是 E-sites iOS Suite 的一部分。


E-sites 日志记录框架。

forthebadge forthebadge

Travis-ci

安装

SwiftPM

package.swift 依赖项

.package(url: "https://github.com/e-sites/lithium.git", from: "9.0.0"),

并在你的应用程序/库目标中,将 "Lithium" 添加到你的 dependencies 中,例如像这样

.target(name: "BestExampleApp", dependencies: ["Lithium"]),

实现

初始化

import Lithium

let logger: Logger = {
    var ll = Logger(label: "com.swift-log.awesome-app")
    ll.logLevel = .trace
    return ll
}()

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
		LoggingSystem.bootstrap { label -> LogHandler in
			var lithiumLogger = LithiumLogger(label: label)
			lithiumLogger.theme = EmojiLogTheme()
			return lithiumLogger
		}
	    
		return true
	}
}