TestsTested | โ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | โ |
Maintained by Kostiantyn Koval.
SpeedLog - Fast Debug logging, easy to disable and improve Swift performance optimization
The Swift print
statements arenโt emitted when compiling in Release mode with enabled optimization. This prevents Swift from performing optimal code optimization.
The SpeedLog allows you to remove print
when the logs are disabled. This allows Swift compiler to perform optimal code optimization and increase application performance.
UIColor
representation 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
has nice UIColor
log style.
All you need to do is enable it once by calling SpeedLog.enableVisualColorLog()
SpeedLog.enableVisualColorLog()
SpeedLog.print("Visual:", c)
SpeedLog.disableVisualColorLog()
SpeedLog.print("Original Restored:", c)
P.S - You also need to install XcodeColors Xcode Plugin. Use Alcatraz to install it.
To enables logs you need to add a Swift Compiler ENABLE_LOG
flag
-D ENABLE_LOG
flagIf you use use CocoaPods
or Carthage
you need to enable it for SpeedLog
framework, not the project itself.
See more details at Stackoverflow
Copy the SpeedLog.swift
file into your project
In order to use colorised console you need to install XcodeColors Xcode plugin.
Use Alcatraz to install it. Go to:
Xcode -> Window -> Package Manager -> Search for XcodeColors
and install it
There are many logging libs I like:
But there is one problem with all of them - itโs not possible to disable them before compiling Swift code.
Next step is:
Get the best features from those libs and integrate them into SpeedLog
Please open an issue with bugs and missing features, functionality or ideas for improvements.
Also you can contribute by following these guidelines:
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Kostiantyn Koval, thats me :)
Thanks to Arthur Ariel Sabintsev for his PrintlnMagic lib
SpeedLog is available under the MIT license. See the LICENSE file for more info.