rainbow_logger 0.0.2
rainbow_logger: ^0.0.2 copied to clipboard
A colorful and expressive Flutter logger for terminal/debug output with emoji prefixes and ANSI color codes.
๐ RainbowLogger #
RainbowLogger is a vibrant and expressive logger for Flutter and Dart CLI applications.
It enhances your debugging experience with visually distinct logs using emoji, colors, timestamps, and customization.
โจ Features #
- โ
Predefined log types:
error
,success
,info
,warning
,log
- ๐จ ANSI terminal coloring mapped from Flutter
Color
s - ๐ Optional timestamps for clear traceability
- ๐ฌ Emoji-based log labeling for instant recognition
- ๐งฉ Customizable prefix, suffix, and color
- ๐ Reusable logger instances for consistent usage across files
- ๐ป Works seamlessly in Flutter, Dart CLI, VS Code, Android Studio, and IntelliJ
๐ Getting Started #
๐ฆ Installation #
Add the dependency to your pubspec.yaml
:
dependencies:
rainbow_logger: ^1.0.0
Then run:
flutter pub get
๐ Import It #
import 'package:rainbow_logger/rainbow_logger.dart';
๐งช Usage #
๐น Static Logging #
Use predefined static methods for quick logging:
RainbowLogger.errorPrint("โ Something went wrong!");
RainbowLogger.successPrint("โ
Operation completed successfully.");
RainbowLogger.infoPrint("โน๏ธ User has entered the dashboard.");
RainbowLogger.warningPrint("โ ๏ธ This is just a warning.");
RainbowLogger.logPrint(
"๐ก Custom colored log",
color: Colors.purple,
prefix: "๐ก",
suffix: "โ๏ธ",
showTimestamp: true,
);
๐ธ Reusable Logger Instance #
Create a custom logger with consistent behavior:
final logger = RainbowLogger(
prefix: "๐",
suffix: "โ
",
color: Colors.cyan,
showTimestamp: true,
);
logger.print("Reusable logger in action!");
๐ฏ Output Example #
[12:00:01] โ Something went wrong!
[12:00:01] โ
Operation completed successfully.
[12:00:01] โน๏ธ User has entered the dashboard.
[12:00:01] โ ๏ธ This is just a warning.
[12:00:01] ๐ก Custom colored log โ๏ธ
[12:00:01] ๐ Reusable logger in action! โ
โ Note: ANSI terminal colors render correctly in popular editors and consoles.
๐ File Structure #
rainbow_logger/
โโโ lib/
โ โโโ rainbow_logger.dart # Core logger class
โ โโโ rainbow_colors.dart # Color-to-ANSI mapping logic
โโโ test/
โ โโโ rainbow_logger_test.dart # Test cases
โโโ README.md # You're reading it
โโโ CHANGELOG.md # Version updates
โโโ LICENSE # MIT License
โโโ pubspec.yaml # Package metadata
๐ง Why Choose RainbowLogger? #
- ๐ Visual Clarity: Color-coded and emoji-marked logs improve readability.
- โฑ Traceability: Timestamps make debugging across events much easier.
- ๐งฉ Customization: Full control over how your logs appear.
- ๐ก Lightweight & Simple: No dependencies outside Flutter SDK.
- ๐ Reusable Configs: Define logger instances with consistent formats.
๐ See Also #
Here are some similar or related packages you may want to explore:
- logger โ A structured logger with pretty print and trees
- ansicolor โ For terminal ANSI styling
- chalkdart โ Chainable terminal styling, inspired by JavaScript's Chalk
๐ ๏ธ Contributing #
Pull requests are warmly welcome!
You can help improve:
- Logger output formatting
- Color configuration logic
- CLI utility extensions
- Documentation enhancements
Feel free to open issues or submit PRs!
๐ License #
MIT License ยฉ 2025 Piyush Kumar
โ Support #
If you found this package helpful, consider giving it a โญ on GitHub!
Happy Logging! ๐