ispectify 1.0.1-dev
ispectify: ^1.0.1-dev copied to clipboard
An additional package for ISpect (logging and handling). Based on Talker.
example/ispectify_example.dart
import 'package:ispectify/ispectify.dart';
Future<void> main() async {
final iSpectify = ISpectify(
options: ISpectifyOptions(
colors: {
ISpectifyLogType.info.key: AnsiPen()..magenta(),
CustomLog.logKey: AnsiPen()..green(),
},
titles: {
ISpectifyLogType.info.key: 'i',
CustomLog.logKey: 'Custom',
},
),
)
..error('The restaurant is closed ❌')
..info('Ordering from other restaurant...')
..provider('Provider is ready')
..good('The food is ready ✅')
..track(
'User clicked on the button',
analytics: 'Amplitude',
parameters: {'button': 'order'},
);
try {
throw Exception('Something went wrong');
} catch (e, st) {
iSpectify.handle(e, st, 'Exception with');
}
iSpectify.logCustom(CustomLog('Something like your own service message'));
}
class CustomLog extends ISpectifyData {
CustomLog(super.message);
static const logKey = 'custom_log_key';
@override
String? get key => logKey;
}