http_logger_plus 1.0.0
http_logger_plus: ^1.0.0 copied to clipboard
A developer-friendly HTTP logger for Dart and Flutter that wraps http.Client and logs all requests and responses with cURL generation, pretty formatting, and color-coded output.
๐งพ 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