π§Ύ http_logger_plus
A developer-friendly HTTP logger for Dart that wraps http.Client
and logs all requests and responses with formatting, cURL command generation, color-coded CLI output, and more.
π Perfect for debugging APIs, inspecting outgoing requests, and logging backend interactions in both CLI tools and Flutter apps.
β¨ Features
- β
Drop-in replacement for
http.Client
- π§Ύ Pretty-printed request & response logs
- π¨ Color-coded terminal output
- π cURL command generation for any request
- π§Ό Truncated body logging for large payloads
- π Easy to extend with custom filters (coming soon)
π Getting started
Add the dependency to your pubspec.yaml
:
dependencies:
http_logger_plus: ^0.0.1
π¦ Usage
void main() async {
final client = HttpLoggerClient(http.Client());
final response = await client.post(
Uri.parse("https://jsonplaceholder.typicode.com/posts"),
headers: {"Content-Type": "application/json; charset=utf-8"},
body: '{"title": "test", "body": "content", "userId": 1}',
);
print("Actual response: ${response.body}");
}
π§ͺ Example Log Output
π¦ [POST] https://jsonplaceholder.typicode.com/posts
Headers:
Content-Type: application/json; charset=utf-8
π‘ curl -X POST "https://jsonplaceholder.typicode.com/posts" -H "Content-Type: application/json; charset=utf-8" -d '{"title": "test", "body": "content", "userId": 1}'
π€ Request Body:
{
"title": "test",
"body": "content",
"userId": 1
}
β¬οΈ Response [201 Created] (407ms)
Response Body:
{
"title": "test",
"body": "content",
"userId": 1,
"id": 101
}
π Example
You can find a complete example in the example/
directory.
π License
MIT License Β© 2025 Ayushman Pal
Libraries
- http_logger_plus
- Support for doing something awesome.