Swiftpack.co -  konkab/AlamofireNetworkActivityLogger as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
konkab/AlamofireNetworkActivityLogger
Network request logger for Alamofire
.package(url: "https://github.com/konkab/AlamofireNetworkActivityLogger.git", from: "3.4.0")

AlamofireNetworkActivityLogger

CocoaPods Compatible Carthage Compatible Platform

Network activity logger for Alamofire.

Requirements

  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
  • Xcode 11+
  • Swift 5.1+

Dependencies

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.10.0+ is required.

To integrate AlamofireNetworkActivityLogger into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

pod 'AlamofireNetworkActivityLogger', '~> 3.4'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate AlamofireNetworkActivityLogger into your Xcode project using Carthage, specify it in your Cartfile:

github "konkab/AlamofireNetworkActivityLogger" ~> 3.4

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding AlamofireNetworkActivityLogger as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/konkab/AlamofireNetworkActivityLogger.git", .upToNextMajor(from: "3.4.0"))
]

Usage

Import the library:

import AlamofireNetworkActivityLogger

Add the following code to AppDelegate.swift application:didFinishLaunchingWithOptions::

NetworkActivityLogger.shared.startLogging()

Now all NSURLSessionTask objects created by an Alamofire.Session will have their request and response logged to the console, a la:

---------------------
GET 'http://example.com/foo/bar.json'
---------------------
200 'http://example.com/foo/bar.json' [0.2535 s]

If the default logging level is too verbose—say, if you only want to know when requests fail—then changing it is as simple as:

NetworkActivityLogger.shared.level = .error

Contact

Konstantin Kabanov

License

AlamofireNetworkActivityLogger is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 174
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Dependencies

Release Notes

Release 3.4.0 for Alamofire 5.4.0
24 weeks ago

Added Alamofire 5.4 support.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API