0 purchases
dog
Dog #
Simple and pretty log package for Dart, includes Flutter and web.
Getting Started #
Install #
dependencies:
dog: any # replace 'any' with version number.
copied to clipboard
import 'package:dog/dog.dart';
copied to clipboard
Usage #
// simple log
dog.v('verbose');
dog.d('debug');
dog.i('info');
dog.w('warning');
dog.e('error');
copied to clipboard
// Map.
dog.i({
'a': 1,
'b': {'b1': '2', 'b2': '2'},
'c': 3
});
// Iterable.
dog.w([1, 2, 3, 4, 5]);
// Function.
dog.d(() => 'This this a message returned by Function.');
copied to clipboard
// Exception/StackTrace
try {
throw Exception('This is an exception.');
} catch (e, st) {
dog.e(e, stackTrace: st);
}
copied to clipboard
// tag and title support
dog.i({'success': true}, tag: 'HTTP', title: 'Response: https://api.example.com/');
copied to clipboard
Web platform support:
Dog level
See Level.
// disable Dog
dog.level = Level.OFF;
copied to clipboard
Formatter
PrettyFormatter: Convert message to pretty styles.
SimpleFormatter: Format message without borders.
Emitter
ConsoleEmitter: Output message to console.
FileEmitter: Output message to file, it doesn't support web platform.
Note #
If you are running a flutter app by AndroidStudio and the console log is not colorful, then try to enable it manually:
dog = Dog(handler: Handler(formatter: PrettyFormatter(), emitter: ConsoleEmitter(supportsAnsiColor: true)));
copied to clipboard
Thanks #
logger: Logger for android.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.