Skip to content

SlavinskiySergey/AlamofireLogger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlamofireLogger

Tiny Alamofire plugin that logs requests and responses.

Examples

✓ Real, real simple, just prints the HTTP method/status code alongside the URL

Alamofire.request(.GET, "http://myapi.com/users").log().responseJSON { response in
    print(response)
}

// GET http://myapi.com/users
// 200 http://myapi.com/users

✓ Print response bodies, too

Alamofire.request(.GET, "http://myapi.com/users").log(level: .Verbose).responseJSON { response in
    print(response)
}

// GET http://myapi.com/users
// 200 http://myapi.com/users: "[{"id": "1", "name": "Ricky"}]"

✓ Different logging levels for requests and responses (e.g. you might only want to print the body of your requests)

Alamofire.request(.PUT, "http://myapi.com/user/1", parameters: ["name": "Julian"], encoding: .JSON)
    .logRequest(level: .Verbose)
    .logResponse(level: .Simple)
    .responseJSON { response in
        print(response)
}

// PUT http://myapi.com/user/1: "{"name":"Julian"}"
// 200 http://myapi.com/user/1

Wishlist

  • Additional verbosity levels, formatting options
  • Pretty-printed JSON

About

Tiny Alamofire plugin that logs requests and responses.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 77.5%
  • Ruby 22.5%