talker 1.3.0+1 talker: ^1.3.0+1 copied to clipboard
Advanced error handler and logger package for flutter and dart apps
import 'package:talker/talker.dart';
Future<void> main() async {
final talker = Talker(
settings: TalkerSettings(),
);
try {
throw Exception('Test service exception');
} catch (e, st) {
talker.handle(e, st, 'Working with string error');
}
try {
throw Exception('Service can`t get test data');
} on Exception catch (e, st) {
talker.handleException(e, st, 'Working with strings exception');
}
talker.log(
'Server error',
logLevel: LogLevel.critical,
);
talker.fine('Log fine');
talker.error('Log error');
talker.good('Log good');
talker.verbose('Log verbose');
talker.warning('Log warning');
talker.critical('Log critical');
final httpLog = HttpTalkerLog('Http good');
talker.logTyped(httpLog);
}
class HttpTalkerLog extends TalkerLog {
HttpTalkerLog(String message) : super(message);
@override
AnsiPen get pen => AnsiPen()..xterm(49);
@override
String generateTextMessage() {
return pen.write(message);
}
}