测试已测试 | ✓ |
Lang语言 | SwiftSwift |
许可证 | MIT |
发布上次发布 | 2016年11月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Kostiantyn Koval 维护。
SpeedLog - 快速的调试日志,易于禁用并提高 Swift 性能优化
以优化方式编译 Release 模式下的 Swift 时,不会输出 print
语句。这阻止 Swift 进行最优代码优化。
SpeedLog 允许你在禁用日志时移除 print
,这允许 Swift 编译器执行最优代码优化,并提高应用性能。
UIColor
表示import SpeedLog
SpeedLog.print("Hello")
SpeedLog.print(["Super"], ["Speed"])
SpeedLog.mode = .FuncName
SpeedLog.print("Show only FunctionName")
//myFunc(): Show only FunctionName
SpeedLog.mode = [.FuncName, .FileName]
SpeedLog.print("Show FunctionName and File name")
//AppDelegate.myFunc(): Show FunctionName and File name
SpeedLog.mode = [.FuncName, .FileName, .Line]
SpeedLog.print("Show 3 options :)")
//AppDelegate.myFunc()[36]: Show 3 options :)
SpeedLog.mode = .FullCodeLocation
SpeedLog.print("Show fullCode, same as above")
//AppDelegate.myFunc()[39]: Show fullCode, same as above
SpeedLog.mode = .AllOptions
SpeedLog.print("Enable All Features")
//2015-11-26 19:32:33.687 AppDelegate.myFunc()[27]: Enable All Features
SpeedLog
有很好的 UIColor
日志样式。
你只需要通过调用 SpeedLog.enableVisualColorLog()
一次性启用它
SpeedLog.enableVisualColorLog()
SpeedLog.print("Visual:", c)
SpeedLog.disableVisualColorLog()
SpeedLog.print("Original Restored:", c)
提示 - 你还需要安装 XcodeColors Xcode 插件。使用 Alcatraz 安装它。
要启用日志,需要添加 Swift Compiler 的 ENABLE_LOG
标志
-D ENABLE_LOG
标志如果你使用 CocoaPods
或 Carthage
,需要为 SpeedLog
框架而不是项目本身启用它。
更多详细信息请参阅 Stackoverflow
将 SpeedLog.swift
文件复制到你的项目中
为了使用彩色控制台,你需要安装 XcodeColors Xcode 插件。
使用 Alcatraz 来安装它。前往
Xcode -> 窗口 -> 软件包管理器 -> 搜索 XcodeColors
并安装它
我喜欢许多日志库
但所有这些中都有一个问题 - 在编译Swift代码之前,无法禁用它们。
下一步是
从这些库中获取最佳特性,并集成到SpeedLog
请打开一个问题,包括错误、缺失的功能、功能或改进的建议。
也可以按照以下指南进行贡献
git checkout -b my-new-feature
)git commit -am '添加一些功能'
)git push origin my-new-feature
)Kostiantyn Koval,就是我 :)
感谢Arthur Ariel Sabintsev提供的PrintlnMagic库
SpeedLog可在MIT许可下使用。有关更多详情,请参阅LICENSE文件。