🌈 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 logging
  • lib/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.


Libraries

rainbow_logger