dev_loggers_flutter 0.0.3
dev_loggers_flutter: ^0.0.3 copied to clipboard
A colorful logging utility for Dart and Flutter that works in PowerShell, VS Code, and Release mode.
Here is the raw text for your README.md. You can copy the code block below completely and paste it into your file.
Markdown
dev_loggers_flutter #
A high-performance, colorful logging utility for Flutter developers.
dev_loggers_flutter makes debugging easier by adding color-coded logs to your terminal. It supports standard ANSI colors for PowerShell, VS Code, and Terminal, and automatically switches to safe, plain-text logging in Release mode.
Features #
- ✅ Colorful Output: Green for success, Red for errors, Cyan for info, and Yellow for warnings.
- ✅ PowerShell Support: Uses
stdoutto ensure colors render correctly in Windows terminals. - ✅ Release Mode Safe: Automatically strips ANSI codes in release builds to prevent log clutter.
- ✅ Timestamped: Every log includes a precise timestamp
[HH:mm:ss.SSS]. - ✅ Tag System: Easily filter logs by custom tags like
[AUTH],[API], or[UI].
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
dev_loggers_flutter: ^0.0.1
Then run:
Bash
flutter pub get
Usage
Import the package in your Dart code:
Dart
import 'package:dev_loggers_flutter/dev_loggers_flutter.dart';
Basic Logging
Dart
// Success (Green) - Great for completed tasks
DevLog.success("User logged in successfully!");
// Error (Red) - Great for catch blocks
DevLog.error("Failed to fetch data from API");
// Warning (Yellow) - Great for non-critical issues
DevLog.warn("User connection is slow");
// Info (Cyan) - Great for general debugging
DevLog.info("App started version 1.0.0");
Custom Logging
You can use the generic .log() method to customize the tag and color:
Dart
DevLog.log(
"Processing payment...",
tag: "PAYMENT",
color: DevLog.blue
);
Example Output
Debug Mode (VS Code / Terminal):
Plaintext
[14:05:22.105] [SUCCESS]: User logged in successfully! <-- (Green Text)
[14:05:22.108] [ERROR]: Failed to fetch data <-- (Red Text)
Release Mode (Logcat / Console):
Plaintext
[14:05:22.105] [SUCCESS]: User logged in successfully!
[14:05:22.108] [ERROR]: Failed to fetch data
License
This project is licensed under the MIT License - see the LICENSE file for details.