{"id":21511991,"url":"https://github.com/strvcom/alamofireeasylogger","last_synced_at":"2025-12-12T06:02:52.920Z","repository":{"id":56066572,"uuid":"165411810","full_name":"strvcom/AlamofireEasyLogger","owner":"strvcom","description":"Easy drop-in Alamofire request \u0026 response logger","archived":false,"fork":false,"pushed_at":"2020-11-27T18:33:36.000Z","size":865,"stargazers_count":18,"open_issues_count":2,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-03-15T01:54:33.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strvcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-12T16:50:16.000Z","updated_at":"2023-10-27T05:40:00.000Z","dependencies_parsed_at":"2022-08-15T12:31:11.182Z","dependency_job_id":null,"html_url":"https://github.com/strvcom/AlamofireEasyLogger","commit_stats":null,"previous_names":["jankaltoun/alamofireeasylogger"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strvcom%2FAlamofireEasyLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strvcom%2FAlamofireEasyLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strvcom%2FAlamofireEasyLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strvcom%2FAlamofireEasyLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strvcom","download_url":"https://codeload.github.com/strvcom/AlamofireEasyLogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085585,"owners_count":21045182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T22:24:49.321Z","updated_at":"2025-12-12T06:02:47.866Z","avatar_url":"https://github.com/strvcom.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlamofireEasyLogger\n\n[![Version](https://img.shields.io/cocoapods/v/AlamofireEasyLogger.svg?style=flat)](https://cocoapods.org/pods/AlamofireEasyLogger)\n[![License](https://img.shields.io/cocoapods/l/AlamofireEasyLogger.svg?style=flat)](https://cocoapods.org/pods/AlamofireEasyLogger)\n[![Platform](https://img.shields.io/cocoapods/p/AlamofireEasyLogger.svg?style=flat)](https://cocoapods.org/pods/AlamofireEasyLogger)\n\n*AlamofireEasyLogger* is an easy drop-in Alamofire request \u0026 response logger. No configuration is needed, it just works.\n\nIt works for all requests and responses. There is no need to call a function on every request. It provides a full request/response logger out of the box and allows for easy overriding in case you have different requirements for what you want to see.\n\n## Requirements\n\n- iOS 10.0+\n- Swift 5.0+\n\n**For Swift 4.2 please use pod version 1.0.0.**\n**For Alamofire 4.6 please use pod version 1.1.0.**\n\n## Dependencies\n\n- [Alamofire 5+](https://github.com/Alamofire/Alamofire)\n\n## Installation\n\n### Swift Package Manager\n\nSimply add URL of this repository into your package dependencies:\n\n```\nhttps://github.com/jankaltoun/AlamofireEasyLogger\n```\n\n### Cocoapods\n\nTo install this library using Cocoapods, simply add the following line to your Podfile\n\n```ruby\npod 'AlamofireEasyLogger'\n```\n\n### Carthage\n\nTo integrate this library using Carthage, add the following line to your Cartfile.\n\n```ruby\ngithub \"jankaltoun/AlamofireEasyLogger\"\n```\n\n## Usage\n\nOut of the box AlamofireEasyLogger provides the `FancyAppAlamofireLogger` class that logs request and responses with their parameters, headers and bodies as in the example below.\n\nThis works for both successful and unsuccessful requests/responses and the output is nicely formatted.\n\n### FancyAppAlamofireLogger log example\n```\n🚀🚀🚀 REQUEST 🚀🚀🚀\n🔈 GET https://api.openweathermap.org/data/2.5/forecast?lat=-26.2041028\u0026lon=28.0473051\u0026APPID=hidden\u0026units=metric\n🚀🚀🚀 REQUEST 🚀🚀🚀\n\n✅✅✅ SUCCESS RESPONSE ✅✅✅\n🔈 GET https://api.openweathermap.org/data/2.5/weather?lat=-26.2041028\u0026lon=28.0473051\u0026APPID=hidden\u0026units=metric\n🔈 Status code: 200\n💡 Access-Control-Allow-Methods: GET, POST\n💡 X-Cache-Key: /data/2.5/weather?APPID=hidden\u0026lat=-26.2\u0026lon=28.05\u0026units=metric\n💡 Server: openresty\n💡 Content-Length: 441\n💡 Date: Sat, 12 Jan 2019 16:30:50 GMT\n💡 Content-Type: application/json; charset=utf-8\n💡 Access-Control-Allow-Origin: *\n💡 Access-Control-Allow-Credentials: true\n💡 Connection: keep-alive\n{\"coord\":{\"lon\":28.05,\"lat\":-26.2},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"base\":\"stations\",\"main\":{\"temp\":29.53,\"pressure\":1015,\"humidity\":37,\"temp_min\":29,\"temp_max\":30},\"wind\":{\"speed\":0.5,\"deg\":310},\"rain\":{\"3h\":0.575},\"clouds\":{\"all\":32},\"dt\":1547308800,\"sys\":{\"type\":1,\"id\":1958,\"message\":0.0103,\"country\":\"ZA\",\"sunrise\":1547263628,\"sunset\":1547312706},\"id\":993800,\"name\":\"Johannesburg\",\"cod\":200}\n✅✅✅ SUCCESS RESPONSE ✅✅✅\n```\n\n### Usage in app\n\nYou need to hold a reference to your logger instance. The place to do this might be your `AppDelegate` or any other place where the reference will stay alive.\n\n```\nimport UIKit\nimport AlamofireEasyLogger\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n    \n    let alamofireLogger = FancyAppAlamofireLogger(prettyPrint: true) {\n        print($0)\n    }\n    \n    ...\n}\n```\n\nAs you can see above the only parameter the logger takes during initialization is `logFunction` closure defined as `public typealias LogFunction = (String) -\u003e Void`.\nThis function is responsible for logging the requests and responses.\nYou can use a simple `print` as in the example above or integrate a logging library of your choice.\n\n### Implementing your own logger\n\nIf the `FancyAppAlamofireLogger` is too verbose for your taste or you want to implement a completely custom logger you can use the `AlamofireLoggerDelegate` of `AlamofireEasyLogger`.\n\nYour logger should be used exactly like the `FancyAppAlamofireLogger` in the example above and should look similar to following piece of code.\n\n```\nclass FancyAppAlamofireLogger: AlamofireLoggerDelegate {\n    \n    let alamofireLogger = AlamofireLogger()\n    \n    public init() {\n        alamofireLogger.delegate = self\n        alamofireLogger.startLogging()\n    }\n    \n    open func networkRequestDidStart(request: AlamofireLoggerRequest) {\n        ...\n    }\n    \n    open func networkRequestDidComplete(request: AlamofireLoggerRequest, result: AlamofireLoggerResult) {\n        ...\n    }\n    \n    open func loggingFailed(error: AlamofireLoggingError) {\n        ...\n    }\n}\n```\n\nAs you can see on this example `AlamofireEasyLogger` is quite versatile and with the use of `AlamofireLoggerDelegate` you're able to develop a completely custom logger while leveraging the `AlamofireLoggerRequest`, `AlamofireLoggerResult` and `AlamofireLoggingError` entities provided to you.\n\n## Author\n\nJan Kaltoun, jan.kaltoun@me.com\n\n## License\n\nPlease do whatever you want with this code.\n\nIf you link to this repository or mention me as the author, it will make me happy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrvcom%2Falamofireeasylogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrvcom%2Falamofireeasylogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrvcom%2Falamofireeasylogger/lists"}