Skip to content

Moein-dev/colorful_log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colorful Log Plus

A simple and powerful debugging logger for Dart applications. This package allows developers to log messages with customizable colors, icons, and context information, making debugging easier and more organized.

Features

  • 📝 Customizable log messages with tags, colors, and icons.
  • 🎨 ANSI color codes for terminal output.
  • 🛑 Error and stack trace logging.
  • 🔍 Source file location tracking (optional).
  • 🚀 Lightweight and easy to use.

Installation

Add the following dependency to your pubspec.yaml:

dependencies:
  colorful_log_plus: ^1.0.8

Then, run:

flutter pub get

Importing the Package

import 'package:colorful_log_plus/colorful_log_plus.dart';

Usage

Basic Logging

debugLog(message: "This is a simple log message");

Logging with a Custom Tag

debugLog(tag: 'Auth', message: "User logged in successfully");

Using Colors

debugLog(
  message: "This is a warning message",
  color: LogColor.yellow,
);

Adding an Icon

debugLog(
  iconType: LogIconType.error,
  message: "Failed to fetch data",
);

Logging Errors with Stack Trace

try {
  throw Exception("Something went wrong");
} catch (e, stack) {
  debugLog(
    message: "An error occurred",
    iconType: LogIconType.error,
    color: LogColor.red,
    error: e,
    stackTrace: stack,
  );
}

Showing Source File Location

debugLog(
  message: "Debugging in progress...",
  showLogAddress: true,
);

Log Levels and Icons

Log Type Icon
Info ℹ️
Warning ⚠️
Error
Debug 🐛

Available Colors

Name Example
Reset 🔲 Reset
Red 🟥 Red
Green 🟩 Green
Yellow 🟨 Yellow
Blue 🟦 Blue
Magenta 🟪 Magenta
Cyan 🟦 Cyan

Contributing

Feel free to open issues or submit pull requests to improve this package!


License

This package is available under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published