groveman

Last updated:

0 purchases

groveman Image
groveman Images
Add to Cart

Description:

groveman

Groveman #




Logging for Dart/Flutter applications.
It's very similar to Android logging library called Timber and also with the package for Dart/Flutter called Fimber that implements the same concept of the tree and planting logging tree.
Behavior is added through Tree instances. You can install an instance by calling Groveman.plantTree. Installation of Trees should be done as early as possible, e.g, in the function main.
There are no Tree implementations installed by default because, second Timber, every time you log in production, a puppy dies.
There is a tree for the debug mode called DebugTree, it's totally configurable.
The logging is formed by the level, tag, message, extra, error and stack trace.
Levels #
For define severity of a logging. The level is set to one of five values, which are, in order of severity:

fatal
error
warning
info
debug

Usage #
Add it in your pubspec.yaml:
dependencies:
groveman:
copied to clipboard
Import it where you want to use it e.g, in your main file.
import 'package:groveman/groveman.dart';
copied to clipboard
Initialize logging tree on start of your application.
void main(){
Groveman.plantTree(DebugTree());

//log
Groveman.debug();
Groveman.info('info', tag: 'info');
Groveman.warning('error', tag: 'info', extra: <String, Object>{
'name': 'Jungle',
'trees': 50,
},
);
Groveman.error('info', tag: 'info', error: Error());
Groveman.fatal('info', tag: 'info', stackTrace: StackTrace.current);
}
copied to clipboard
You can plant a tree depending on the mode, e.g debug and production.
void main(){
if (kReleaseMode) {
Groveman.plantTree(CrashlyticsTree());
} else {
Groveman.plantTree(DebugTree());
}
}
copied to clipboard
Configure to capture exception in Zone and in current Isolate
void main(){
Groveman.captureErrorInZone(() => runApp(MyApp()));
Groveman.captureErrorInCurrentIsolate();
}
copied to clipboard
Look at the example app to see Groveman in action.
Debug Tree #
Uses the dart:developer log() function to show logging.

It's only shown in debug mode, so there's no problem keeping DebugTree in production.

Format of the output
[Log Level] [tag]: message
extra
Error
StackTrace
copied to clipboard

The extra will be showed formatted as JSON.
If the tag is not provided, the implementation will automatically figure out from which file and line it's being called and use that file name and line as its tag.
You can set to not show the tag.
Groveman.plantTree(DebugTree(showTag: false));
copied to clipboard
The log level text can be replaced for emoji.
Groveman.plantTree(DebugTree(showEmoji: true));
copied to clipboard
Sets method count, used when there is the stack trace.
// Log Level - debug, info, warning
Groveman.plantTree(DebugTree(methodCount: 2));
// Log Level - error, fatal
Groveman.plantTree(DebugTree(errorMethodCount: 2));
copied to clipboard
Still is possible to colorize your logs.
Groveman.plantTree(DebugTree(showColor: true));
copied to clipboard
There is a problem with the show of the stack trace in flutter web, you can see here https://github.com/flutter/flutter/issues/79176
Others officially supported Trees #

groveman_crashlytics
groveman_sentry

You can create your, just extend the Tree class.
Take a look at the DebugTree code to know more.
📝 Maintainers #
Kauê Martins
🤝 Support #
You liked this package? Then give it a ⭐️. If you want to help then:

Fork this repository
Send a Pull Request with new features
Share this package
Create issues if you find a bug or want to suggest a new extension

Pull Request title follows Conventional Commits. The scope available is groveman.
📝 License #
Copyright © 2022 Kauê Martins.
This project is MIT licensed.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.