dispatchLogger method
StreamSubscription<EventAction<T> >
dispatchLogger({
- String? tag,
- String formatter(
- EventAction<
T>
- EventAction<
事件日志记录器
tag
自定义日志标签
level
日志级别
formatter
自定义日志格式化方法
Implementation
StreamSubscription<EventAction<T>> dispatchLogger({
String? tag,
String Function(EventAction<T>)? formatter,
}) {
_loggerSubscription?.cancel();
_loggerSubscription = _eventActionSubject
.log(
tag: tag ?? '${T.toString()} Action',
formatter: formatter ??
(action) => 'Event: ${action.event}, Data: ${action.data}',
)
.listen((_) {});
return _loggerSubscription!;
}