HTZDebugLog
非常简单的记录器。
要求
- iOS 9.3+
- macOS 10.10+
- Xcode 11.1+
- Swift 5
安装
CocoaPods
HTZDebugLog 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行
pod "HTZDebugLog"
Carthage
您可以使用 Carthage 通过在 Cartfile 中添加它来安装 HTZDebugLog。
github "HituziANDO/HTZDebugLog"
如果您使用 Carthage 构建依赖项,请确保您已将 HTZDebugLog.framework 添加到目标的 "Frameworks, Libraries, and Embedded Content" 部分,并在 Carthage 框架复制构建阶段中包含它们。
开始使用
-
导入
import HTZDebugLog
-
设置日志级别
在 AppDelegate 的 application(_:didFinishLaunchingWithOptions:) 方法中编写以下代码。
HTZDebugLog.level = .debug
如果您想禁用调试日志,请将级别设置为
.off
。HTZDebugLog.level = .off
-
输出日志
HTZDebugLog.d("Debug log") HTZDebugLog.i("Info log") HTZDebugLog.w("Warn log") HTZDebugLog.e("Error log")