colorful_log_plus 1.0.8
colorful_log_plus: ^1.0.8 copied to clipboard
A Dart package for logging messages with colorful console outputs for enhanced readability and debugging.
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.