iOS logging framework inspired by Timber and square/logcat.
-
Install the library into your project.
- Swift Package Manager:
.package(url: "https://github.com/ameriod/ForestKit.git", from: "1.0.0") - Carthage: Coming Soon
- Cocoapods: Coming Soon
- Swift Package Manager:
-
Install any tree instances in the ApplicationDelegate by calling
Forest.plant(tree)- ForestKit.OSLogTree
- ForestKit.PrintTree
- ForestKit.FileOutputTree
- Any class that extends from
Tree
-
Create typealias
ForestKit.instanceand add a pubic variable ofForestso you do not need to importForestKitor callForest.instanceeverywhere in the app.
public typealias ForestKitLogging = ForestKit
public let Forest = ForestKitLogging.instance- Call
Forestwith any of the logging options.- If logging is turned off then the message string will not be interpolated.
To disable logging just do not plant any trees. To remove a tree at run time call Forest.uproot(tree) or to remove all trees Forest.uprootAll()
See the sample app for more usage.
The ForestKitView.LogViewer provides a SwiftUI view to view the logs producted by the ForestKit.FileOutputTree. Simplly add it the your debug menu of the app, and then you can search, filter, sort and copy the log messages.
The project is generated by Tuist.
Install Tuist and from the project directory run:
tuist generateAfter running generate the Forest.xcodeproj and Forest.xcworkspace will be generated.
If there are any new files added when you pull down from git you will need to regenerate the project.
- Add a
URLProtocolto log network requests. - Include the
URLProtocollogs in theForestKitView.LogViewer - Add Carthage support.
- Add Cocopods support.
- Add CI/CD to build the project.
- Add tests for
ForestKit.
ForestKit is MIT-Licensed and it is included in the root of the repository.