Skip to content

iOS logging framework inspired by Timber and square/logcat

License

Notifications You must be signed in to change notification settings

ameriod/ForestKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ForestKit

iOS logging framework inspired by Timber and square/logcat.

Useage ForestKit

  1. 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
  2. Install any tree instances in the ApplicationDelegate by calling Forest.plant(tree)

  3. Create typealias ForestKit.instance and add a pubic variable of Forest so you do not need to import ForestKit or call Forest.instance everywhere in the app.

public typealias ForestKitLogging = ForestKit
public let Forest = ForestKitLogging.instance
  1. Call Forest with 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.

Usage ForestKitView

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.

Project setup

The project is generated by Tuist.

Install Tuist and from the project directory run:

tuist generate

After 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.

TODOs

  • Add a URLProtocol to log network requests.
  • Include the URLProtocol logs in the ForestKitView.LogViewer
  • Add Carthage support.
  • Add Cocopods support.
  • Add CI/CD to build the project.
  • Add tests for ForestKit.

License

ForestKit is MIT-Licensed and it is included in the root of the repository.