Timelane Core

Timelane Icon

用于 Timelane 的核心日志记录包

通常,您会使用更高级别的包,该包提供与某些库(例如 TimelaneCombine)一起使用的助手。

如果您想直接向 Timelane 报告事件,或者想为新库添加 Timelane 支持,请考虑使用此包。

记录订阅

要为名为“My Subscription”的订阅绘制一个通道 (lane)

// Subscription begin
let subscription = Timelane.Subscription(name: "My Subscription")
subscription.begin(source: "MyFile.swift:120")

// Successfully end subscription
subscription.end(state: .completed)

// End with failure
subscription.end(state: .error("Error Message"))

记录事件

要为名为“My Subscription”的订阅绘制一个包含值和事件的通道 (lane)

let subscription = Timelane.Subscription(name: "My Subscription")

subscription.event(value: .value(String(describing: 10)), source: "MyFile.swift:120")
subscription.event(value: .value(String(describing: 20)), source: "MyFile.swift:120")

subscription.end(state: .completed)
// or
subscription.end(state: .error("My Error"))

安装

Swift Package Manager

I. 在 Xcode 中自动安装

II. 在您的 Package.swift 文件中手动添加

.package(url: "https://github.com/icanzilb/TimelaneCore", from: "2.0.0")

CocoaPods

CocoaPods 是 Cocoa 项目的依赖项管理器。有关使用和安装说明,请访问他们的网站。要使用 CocoaPods 将 TimelaneCore 集成到您的 Xcode 项目中,请将其添加到您的 Podfile

pod 'TimelaneCore', '~> 2.0'

Carthage

Carthage 是一个去中心化的依赖项管理器,可以构建您的依赖项并为您提供二进制框架。 要使用 Carthage 将 TimelaneCore 集成到您的 Xcode 项目中,请将其添加到您的 Cartfile

github "icanzilb/TimelaneCore" ~>2.0

演示

Timelane 包包含一个演示应用程序,位于:https://github.com/icanzilb/timelane

许可证

版权所有 (c) Marin Todorov 2020 此软件包根据 MIT 许可证提供。