log method

Stream<T> log({
  1. String? tag,
  2. String formatter(
    1. T value
    )?,
})

Implementation

Stream<T> log({
  String? tag,
  String Function(T value)? formatter,
}) {
  return doOnData((value) {
    final message = formatter?.call(value) ?? '$tag: Received - $value';
    RxLogger.log(message);
  }).doOnCancel(() {
    RxLogger.log('$tag: Cancelled');
  }).doOnDone(() {
    RxLogger.log('$tag: Done');
  }).doOnError((error, stackTrace) {
    RxLogger.logError(error, stackTrace);
  });
}