Last updated:
0 purchases
flogger
Flogger Dart Library #
Description #
Flogger is a simple yet powerful logging library for Dart applications. It supports various logging levels, such as debug, info, warning, and error, and provides beautifully formatted console output. This library is ideal for those who wish to keep track of activities within their application, find bugs, or monitor app performance.
Features #
Supports logging for debug, info, warning, and error levels.
Thread and source caller information.
Predefined log message templates with customizable tags.
Global toggling of log status.
Utilizes Dart's developer logging capabilities.
Installation #
To include this package in your Dart project, add it to your pubspec.yaml file:
dependencies:
flogger: ^latest_version
copied to clipboard
Then run pub get.
Usage #
First, import the package in your Dart code:
import 'package:flogger/flogger.dart';
copied to clipboard
Here are a few ways to use the library:
Debug Log #
// Singleton
var log = Flogger();
copied to clipboard
log.d(DateTime.now());
/*
[π [DEBUG]: FloggerTag]
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βThread: main, Source: #2 ExampleController.chooseDate (example/main.dart:13:13) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β 2023-09-16 23:43:16.678749 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
*/
copied to clipboard
Warning Log with Custom Tag #
log.w("Warning message", tag: "WarningTag");
/*
[οΈ [WARNING]: WarningTag]
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βThread: main, Source: #2 ExampleController.clickButton (example/main.dart:16:18)β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Warning message β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
*/
copied to clipboard
Error Log #
log.e({"error":"msg error" , "status": 404});
/*
[β [ERROR]: FloggerLogs]
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βThread: main, Source: #2 ExampleController.requestServer (example/main.dart:13:13)β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β{error: msg error, status: 404} β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
*/
copied to clipboard
API #
Global Configurations #
isLoggingEnabled: Boolean to enable or disable logging globally.
globalLogTag: A string used as the global tag for the log if no tag is specified in the individual log methods.
Methods #
d(Object? obj, {String? tag}): Logs a debug message.
i(Object? obj, {String? tag}): Logs an info message.
w(Object? obj, {String? tag}): Logs a warning message.
e(Object? obj, {String? tag}): Logs an error message.
Contributions #
Contributions, issues, and feature requests are welcome!
License #
This project is licensed under the MIT License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.