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.
- ✅ 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)
Add the dependency to your pubspec.yaml:
dependencies:
http_logger_plus: ^0.0.1void 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}");
}🟦 [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
}
You can find a complete example in the example/ directory.
MIT License © 2025 Ayushman Pal