AlamofireSafariLogger - a lightweight Alamofire call debugger
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
- iOS 8.0+
- Xcode 8.0+
- Swift 3.2+
Usage
This project is inspired by AlamofireNetworkActivityLogger and facebook Stetho library. Reference: https://github.com/konkab/AlamofireNetworkActivityLogger https://github.com/facebook/stetho
The aim of this project is to log the Alamofire request and response to the Safari Web Inspector. By console log method in javascript, header and body is logged in console tab.
Console Log : Header Console Warn: Body Console Error:Error
Import the library:
import AlamofireSafariLogger
Add the following code to AppDelegate.swift application:didFinishLaunchingWithOptions:
:
AlamofireSafariLogger.shared.startLogging()
Open Safari , enable developer menu.
- To log iOS Device, in your device , Setting > Safari > Advanced > enable "Web Inspector"
Open web inspector in developer menu when your app is running.
!!!Remember to prevent library's execution in your production app, i.e.
#if DEBUG
AlamofireSafariLogger.shared.startLogging()
#endif
Features
public var isGroupCollapse : Bool = true
public var isLogRequestHeader : Bool = true
public var isLogRequestBody : Bool = true
public var isLogResponseHeader : Bool = true
public var isLogResponseBody : Bool = true
public var isLogError : Bool = true
public var isDisableLog : Bool = false
Not Support multipart/form-data request body
Installation
AlamofireSafariLogger is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AlamofireSafariLogger'
Author
License
AlamofireSafariLogger is available under the MIT license. See the LICENSE file for more info.