A simple and customizable logger for Dart and Flutter applications. The tarsier_logger
package helps you format log messages dynamically, add color-coded outputs, and manage consistent logging across your project.
- Dynamic Padding: Automatically adjusts padding with hyphens to align messages neatly.
- Color-Coded Logs: Supports ANSI color codes for enhanced readability in the terminal.
-
Static and Instance-Based Logging:
- Instance-based logging for advanced customization.
- Static logging for quick and convenient use.
- Customizable Max Line Length: Control the overall length of log messages.
Add tarsier_logger
to your pubspec.yaml
:
dependencies:
tarsier_logger: ^1.0.0
Run the following command to install the package:
flutter pub get
You can use an instance of the TarsierLogger
class to log messages with dynamic padding and color coding.
import 'package:tarsier_logger/tarsier_logger.dart';
final logger = TarsierLogger();
logger.i('This is an informational message.');
logger.s('This is a success message.');
logger.w('This is a warning message.');
logger.e('This is an error message.');
For a quick and convenient way to log messages, use the static wrapper:
import 'package:tarsier_logger/tarsier_logger.dart';
TarsierLogger.info("Static informational message.");
TarsierLogger.success("Static success message.");
TarsierLogger.warning("Static warning message.");
TarsierLogger.error("Static error message.");
You can log messages with custom colors using the log method:
TarsierLogger.log('Custom Message with Blue Color', color: blue);
The following colors are built-in and can be used for customizing log messages:
-
green
: Success messages -
red
: Error messages -
blue
: Informational messages -
yellow
: Warnings -
reset
: Resets to default terminal color
This package is licensed under the MIT License.
Feel free to open an issue or submit a pull request on GitHub.
The tarsier, one of the smallest primates, symbolizes simplicity and adaptability—just like this package! 🐒