Alamofire 的日志支持
要使用 CocoaPods 安装 Alamofire+Logging,请将以下行添加到您的 Podfile
。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'AlamofireLogging'
Carthage 是一个去中心化的依赖管理器,它可以构建您的依赖项并为您提供二进制框架。
您可以使用 Homebrew 使用以下命令安装 Carthage
$ brew update
$ brew install carthage
要使用 Carthage 将 Alamofire+Logging 集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github 'Digipolitan/alamofire-logging' ~> 1.0
运行 carthage update
以构建框架,并将构建的 AlamofireLogging.framework
拖到您的 Xcode 项目中。
Swift Package Manager 是一个用于自动化 Swift 代码分发的工具,并已集成到 swift
编译器中。
一旦您设置好 Swift 包,将 Alamofire+Logging 添加为依赖项就像将其添加到您的 Package.swift
的 dependencies
值中一样简单。
dependencies: [
.package(url: "https://github.com/Digipolitan/alamofire-logging.git", from: "1.0.0")
]
SessionManager.default.request("http://date.jsontest.com").log(level: .verbose).responseJSON { (response) in
switch response.result {
case .success(let value):
print("Alamofire \(value)")
case .failure(let error):
print("\(error)")
}
}
日志有多个级别
有关更多详细信息,请参阅 CONTRIBUTING.md!
本项目遵循 贡献者盟约行为准则。通过参与,您需要遵守此准则。请向 contact@digipolitan.com 报告不可接受的行为。
Alamofire+Logging 在 BSD 3-Clause license 许可下获得许可。