轻巧、神奇、易于使用的 Swift 应用日志记录器。
要打印 Info
ℹ️ 信息,请使用 ZLogger.info(message:)
要打印 Warning
ZLogger.warning(message:)
要打印 Error
ZLogger.error(message:)
ZLogger 带有 3 个日志严重级别,类型为 LogEvent:.info
、.warning
、.error
默认情况下,ZLogger 将显示所有消息,但您可以使用 ZLogger.filter
变量来过滤它们,该变量需要一个 LogEvent
枚举
LogEvent.info
将显示所有消息
LogEvent.warning
将显示 .error
和 .warning
LogEvent.error
将仅显示 .error
示例应用程序是了解 ZLogger
实际效果的最佳方式。只需打开 ZLogger.xcodeproj
并运行 Example
方案。
ZLogger 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile
pod 'ZLogger'
Carthage 是一个去中心化的依赖管理器,它可以构建您的依赖项并为您提供二进制框架。
要使用 Carthage 将 ZLogger 集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "Soucolline/ZLogger"
运行 carthage update
来构建框架,并将构建的 ZLogger.framework
拖到您的 Xcode 项目中。
在您的应用程序目标的“Build Phases”设置选项卡中,单击“+”图标并选择“New Run Script Phase”,然后按照 Carthage Getting started Step 4、5 和 6 中所述添加 Framework 路径
要使用 Apple 的 Swift Package Manager 进行集成,请将以下内容作为依赖项添加到您的 Package.swift
dependencies: [
.package(url: "git@github.com:soucolline/ZLogger.git", from: "1.0.2")
]
如果您不想使用上述任何依赖管理器,您可以手动将 ZLogger 集成到您的项目中。只需将 Sources
文件夹拖到您的 Xcode 项目中即可。
ZLogger
Copyright (c) 2019 Thomas Guilleminot guilleminot.thomas@gmail.com
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.