Setting up network logs
- Swift
- Objective-C
AFNetworking
To enable network logging for AFNetworking, create and use the following class.GleapAFURLSessionManager
.
Alamofire
To enable network logging for Alamofire, create and use the following class.SessionManager
.
Moya
The Gleap Moya plugin intercepts all requests and forwards them to the Gleap SDK.Installation
Swift Package Manager
To get started, open your Xcode project and select File > Add packages… Now you need to paste the following package URL to the search bar in the top right corner. Hit enter to confirm the search. Package URL:Manual installation
Simply copy the GleapMoyaPlugin.swift (Sources/GleapMoyaPlugin) from this repository into your project. In addition to that make sure to install Gleap & Moya.Using the plugin
After installing the plugin, you can use it by simply declaring it during the initialization of your Moya provider:Using an older Moya version?
If you are using an older Moya version, simply use the GleapMoyaPlugin from here.Filtering network logs
Gleap allows you to strip off specific key/value pairs from network logs. This empowers you to easily remove sensitive data liketokens, passwords
or usernames
.
How does it work?
Log in to the Gleap dashboard and open the visual widget configurator. Now enable thenetwork log filters
option (within the advanced options tab). Once the option is enabled, you can add multiple keys to the array bellow, which should be excluded.
All keys, which you add to the exclusion list, will be loaded together with the widget configuration. Before sending a feedback item to our backend, the client SDK will loop through all network requests and stripe off all matching key/value pairs from the request headers
, header-payload
(if it’s a JSON) and response body
(if it’s a JSON).
This ensures that sensitive information will never even leave the client application.
Example:
If you want to remove the Authorization bearer token from your requests, simply add “Authorization” to the list of keys. Set filter with code
It’s also possible to set the network log filters by code.Blacklisting URLs
It is possible to blacklist URLs or parts of URLs. If a network request matches one of the entries in the blacklist, the network request won’t be included in the network logs. To add a new entry to the blacklist, simply navigate to your project in the Gleap dashboard and open the visual widget configurator. Now click onDeveloper options
and add the desired URLs.