0 purchases
dart log
A simple dart console logger (release mode enabled/disabled and "limitless" characters) #
Usage #
logger.d('message');
logger.e('message');
logger.i('message');
logger.w('message');
logger.trace('message');
logger.prod('message');
copied to clipboard
final tagLogger = logger.withTag('MY_TAG');
tagLogger.d('message'); // [MY_TAG]: message
copied to clipboard
logger.d('{"id": 123}', isJson: true);
/*
{
"id": 123
}
*/
copied to clipboard
// Log in release mode
logger.prod('message');
copied to clipboard
All logs enabled in release mode (using dart-define)
flutter build apk --release --dart-define dart_log_verbose="true"
copied to clipboard
Print max to "N" chars (useful with long api responses)
logger.d('long response from API', maxChars: 10000);
copied to clipboard
fileLinkLevel: use this to get the link of the file that dispatched the log
// default = 3
logger.d('Link to file', fileLinkLevel: 3);
copied to clipboard
Interceptors
Use the DefaultLogInterceptor or implement a custom LogInterceptor
Logger.interceptors.add(DefaultLogInterceptor((Object? data) {
print('ERROR: $data');
}, logTypes: [LogType.error]));
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.