flutter_smart_logger 0.0.1
flutter_smart_logger: ^0.0.1 copied to clipboard
A lightweight Flutter package for smart, formatted, and full debug logging of API responses and app data — works only in debug mode.
flutter_smart_logger
A lightweight Flutter package for smart, formatted, and full debug logging of API responses and app data — works only in debug mode. Prints large JSON responses, supports pretty formatting, and automatically colors logs based on status codes.
🚀 Features Executes only in debug mode — no impact on release builds. Prints long responses fully, avoiding truncation by debugPrint. Automatically colors logs based on statusCode: Green → Success (200–299) Yellow → Redirects (300–399) Red → Errors (400–599) Prints pretty JSON for maps and lists.
🛠 Usage // Log a simple debug message SmartLogger.log("Fetching API data...", tag: "Network");
// Log a JSON response (nested or large) SmartLogger.log({ "result": { "statusCode": 200, "message": "Booking saved successfully", "pnrNumber": "TS250924141026562286ROPI", "ticketStatus": "Confirmed" } }, tag: "API");
// Log an error response SmartLogger.log({"statusCode": 404, "error": "Ticket not found"}, tag: "API");
💡 Notes Works only in debug mode, completely ignored in release. Large responses are split into chunks to avoid truncation. Colors work in VS Code and Android Studio console. Windows CMD may not support colors.