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! π