Skip to content

About

DataTaskPublisher extension that logs the request and response to the console

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetworkLogger

Extension of Combine's DataTaskPublisher that logs the request and response to the console.

Usage

URLSession.shared.dataTaskPublisher(for: url)
    .log()

Then after the Publisher is subscribed the log method prints something like

⬆️ POST https://mysuper.api
Headers: [
    Authorization : Bearer XYZ
]
Body: {
    "key": "value"
}

and when the response comes

⬇️ POST https://mysuper.api (✅ 200 OK)
Headers: [
    Content-Type : application/json
]
Body: {
    "response": {
        "key": 1
    }
}

Inspiration

This library was inspired by Reqres.

License

MIT License

About

DataTaskPublisher extension that logs the request and response to the console

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages