ZLogger
轻量级、魔法般、易于使用的 Logger,适用于您的 Swift 应用。
使用方法
要打印 Info
ZLogger.info(message>:
要打印 Warning
ZLogger.warning(message:
要打印 Error
ZLogger.error(message:
ZLogger 提供了三种日志严重程度级别,类型为 LogEvent: .info
、.warning
、.error
默认情况下,ZLogger 会显示每条消息,但您可以使用 ZLogger.filter
变量进行过滤,该变量要求一个 LogEvent
枚举
LogEvent.info
将显示每条消息
LogEvent.warning
将显示 .error
和 .warning
LogEvent.error
只会显示 .error
示例
示例应用程序是查看 ZLogger 行动的最佳方式。只需打开 ZLogger.xcodeproj
并运行 Example
方案。
安装
CocoaPods
ZLogger 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 中
pod 'ZLogger'
Carthage
Carthage 是一个去中心化的依赖管理器,用于构建您的依赖并提供二进制框架。
要使用 Carthage 将 ZLogger 整合到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "Soucolline/ZLogger"
运行 carthage update
构建框架并将构建的 ZLogger.framework
拖放到您的 Xcode 项目中。
在您的应用目标的“构建阶段”设置选项卡中,点击“+”图标并选择“新运行脚本阶段”,然后添加在 Carthage 简明指南的第 4、5 和 6 步中提到的框架路径
Swift Package Manager
要使用苹果的 Swift Package Manager 整合,请将以下内容作为依赖项添加到您的 Package.swift
中
dependencies: [
.package(url: "[email protected]:soucolline/ZLogger.git", from: "1.0.2")
]
手动
如果您不希望使用上述任何依赖管理器,您可以将 ZLogger 手动整合到您的项目中。只需将 Sources
文件夹拖放到您的 Xcode 项目中即可。
许可协议
ZLogger
Copyright (c) 2019 Thomas Guilleminot [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.