Skip to content
Simplify debugging by showing network requests of your app as they happen.
Swift Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
Loggie
.gitignore
LICENSE
Loggie.podspec
README.md
_Pods.xcodeproj
icon.svg

README.md

Loggie

Build Status Version License Platform

Loggie

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Xcode 8
  • iOS 8

Usage

1. Register custom LoggieURLProtocol in the application:didFinishLaunchingWithOptions method:
// Swift
URLProtocol.registerClass(LoggieURLProtocol.self)
// Objective-C
[NSURLProtocol registerClass:[LoggieURLProtocol class]];
2. If you use NSURLSession (or AFNetworking/Alamofire) make sure that you use loggieSessionConfiguration:
// Swift
URLSession(configuration: URLSessionConfiguration.loggie)
// Objective-C
[NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration loggieSessionConfiguration]];
3. At the point where you want to display network logs, you can just put the following line:
// Swift
LoggieManager.shared.showLogs(from: viewController)
// Objective-C
[[LoggieManager sharedManager] showLogsFromViewController:viewController filter:nil];

You can create custom output or UI to show network logs. To get an array of all network logs just call:

// Swift
let logs = LoggieManager.shared.logs
// Objective-C
NSArray<Log *> *array = [[LoggieManager sharedManager] logs];

If you would like to receive notifications when new logs are added to the list, your app can observe LoggieDidUpdateLogs notification.

Important:

Please make sure that LogieURLProtocol and loggieSessionConfiguration are not used in production builds.

Installation

Loggie is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Loggie'

Author

Filip Beć, filip.bec@gmail.com

Credits

Maintained and sponsored by Infinum.

Infinum logo

License

Loggie is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.