π RainbowLogger
RainbowLogger is a colorful and expressive logger for Flutter and Dart apps.
It adds clarity and visual appeal to your console output using emoji, colors, and timestamps β
perfect for stylish and structured debugging!
β¨ Features
- β
Predefined log types:
error,success,info,warning,log - π¨ ANSI terminal coloring mapped from Flutter
Colors - π Optional timestamps for better log tracing
- π§© Custom prefix, suffix, and color
- π Reusable logger instances with configurable settings
- π» Works with both Flutter and pure Dart CLI apps
π Installation
Add to your pubspec.yaml:
dependencies:
rainbow_logger: ^1.0.0
Then run:
flutter pub get
π¦ Import
import 'package:rainbow_logger/rainbow_logger.dart';
π§ͺ Usage
πΉ Quick Static 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
final logger = RainbowLogger(prefix: "π",suffix: "β
",color: Colors.cyan,showTimestamp: true,);
logger.print("Reusable logger in action!");
π Output Example (Styled)
[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 colors appear correctly in terminals and IDE consoles like VS Code, IntelliJ, or Android Studio.
π File Structure
lib/rainbow_logger.dartβ Core logger class with static and instance logginglib/rainbow_colors.dartβ Helper class for color-to-ANSI mapping
π§ Why Use RainbowLogger?
- Easier debugging with structured and colorful logs
- Visual cues for better log scanning and error detection
- Simple to use and lightweight
- Fully customizable with emoji, colors, and timestamps
π License
MIT License Β© 2025 Piyush Kumar
π‘ Contributions
Pull requests are welcome!
Feel free to open issues or suggest improvements.