Ejemplo n.º 1
0
        protected override async Task <ActionEvent> NotifyActionEventAsync(ActionEvent actionEvent)
        {
            var type     = actionEvent.Type;
            var typeName = type.GetDescription();
            var target   = actionEvent.Target;

            switch (type)
            {
            case ActionEventType.EvtError:
            {
                var ex = (QQException)target;
                Logger.LogError($"[Action={ActionName}, Result={typeName}, {ex}");
                await _context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.Error, ex));

                break;
            }

            case ActionEventType.EvtRetry:
            {
                var ex = (QQException)target;
                Logger.LogWarning($"[Action={ActionName}, Result={typeName}, RetryTimes={RetryTimes}][{ex.ToSimpleString()}]");
                break;
            }

            case ActionEventType.EvtCanceled:
                Logger.LogWarning($"[Action={ActionName}, Result={typeName}, Target={target}]");
                break;

            default:
                Logger.LogDebug($"[Action={ActionName}, Result={typeName}]");
                break;
            }
            return(await base.NotifyActionEventAsync(actionEvent));
        }
Ejemplo n.º 2
0
 public static Task FireNotifyAsync(this IQQContext context, QQNotifyEventType type, object target = null)
 {
     return(context.FireNotifyAsync(QQNotifyEvent.CreateEvent(type, target)));
 }