AlamofireNetworkActivityLogger

repository·master·Indexed 42 days ago

https://github.com/konkab/alamofirenetworkactivitylogger

A utility for Alamofire that automatically logs network request and response details, including URL, method, status code, and duration, to the console. Supports integration via CocoaPods, Carthage, and Swift Package Manager.

Tokens
577
Snippets
5
Records
5
Agent score
3%

What's inside AlamofireNetworkActivityLogger

  1. Install AlamofireNetworkActivityLogger via CocoaPods

    master

    To integrate AlamofireNetworkActivityLogger using CocoaPods, ensure you have CocoaPods 1.10.0+ installed. Add the following to your Podfile:

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!
    
    pod 'AlamofireNetworkActivityLogger', '~> 3.4'

    Then, run pod install in your terminal.

  2. Use AlamofireNetworkActivityLogger to log network requests

    master

    To start logging all NSURLSessionTask objects created by an Alamofire.Session, import the library and call startLogging() on the shared instance within your AppDelegate.

    All requests and responses will be printed to the console in a formatted block showing the HTTP method, URL, status code, and duration.

    import AlamofireNetworkActivityLogger
    
    // In AppDelegate.swift
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        NetworkActivityLogger.shared.startLogging()
        return true
    }