https://github.com/moein-dev/colorful_log
https://github.com/moein-dev/colorful_log
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/moein-dev/colorful_log
- Owner: Moein-dev
- License: mit
- Created: 2025-01-27T13:00:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T13:30:47.000Z (over 1 year ago)
- Last Synced: 2025-02-04T14:34:35.822Z (over 1 year ago)
- Language: C++
- Size: 308 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`:
```yaml
dependencies:
colorful_log_plus: ^1.0.8
```
Then, run:
```sh
flutter pub get
```
---
## Importing the Package
```dart
import 'package:colorful_log_plus/colorful_log_plus.dart';
```
---
## Usage
### Basic Logging
```dart
debugLog(message: "This is a simple log message");
```
### Logging with a Custom Tag
```dart
debugLog(tag: 'Auth', message: "User logged in successfully");
```
### Using Colors
```dart
debugLog(
message: "This is a warning message",
color: LogColor.yellow,
);
```
### Adding an Icon
```dart
debugLog(
iconType: LogIconType.error,
message: "Failed to fetch data",
);
```
### Logging Errors with Stack Trace
```dart
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
```dart
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.