public virtual void NotifyActionEvent(QQActionEventType type, object target) { switch (type) { case QQActionEventType.EvtError: { var ex = (QQException)target; //Context.Logger.LogError($"[Action={GetType().Name}, Type={type}, {ex}"); Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.NetError, ex)); break; } case QQActionEventType.EvtRetry: { var ex = (QQException)target; // Context.Logger.LogWarning($"[Action={GetType().Name}, Type={type}, RetryTimes={_retryTimes}][{ex.ToSimpleString()}]"); break; } case QQActionEventType.EvtCanceled: { //Context.Logger.LogInformation($"[Action={GetType().Name}, Type={type}, Target={target}]"); break; } default: { //Context.Logger.LogDebug($"[Action={GetType().Name}, Type={type}"); break; } } Listener?.Invoke(this, new QQActionEvent(type, target)); }
private bool IsFinalEvent(QQActionEvent Event) { QQActionEventType type = Event.Type; return(type == QQActionEventType.EVT_CANCELED || type == QQActionEventType.EVT_ERROR || type == QQActionEventType.EVT_OK); }
public virtual void NotifyActionEvent(QQActionEventType type, object target) { switch (type) { case QQActionEventType.EVT_ERROR: var ex = (target as Exception) ?? new QQException(QQErrorCode.UNKNOWN_ERROR); #if DEBUG MyLogger.Default.Error($"{GetType().Name} [type={type.GetDescription()}, exception={ex.Message}, stacktrace={ex.StackTrace}]", ex); #else MyLogger.Default.Debug($"{GetType().Name} [type={type.GetDescription()}, exception={ex.Message}", ex); #endif break; case QQActionEventType.EVT_CANCELED: MyLogger.Default.Info($"{GetType().Name} [type={type.GetDescription()}, target={target}]"); break; default: MyLogger.Default.Debug($"{GetType().Name} [type={type.GetDescription()}, target={target}]"); break; } Listener?.Invoke(ActionFuture, new QQActionEvent(type, target)); }
public void NotifyActionEvent(QQActionEventType type, object target) { Listener?.Invoke(this, new QQActionEvent(type, target)); }
public QQActionEvent(QQActionEventType type, object target) { Type = type; Target = target; }
public virtual void NotifyActionEvent(QQActionEventType type, object target) { switch (type) { case QQActionEventType.EVT_ERROR: var ex = (target as Exception) ?? new QQException(QQErrorCode.UNKNOWN_ERROR); MyLogger.Default.Error($"{GetType().Name} [type={type.GetDescription()}, exception={ex.Message}, stacktrace={ex.StackTrace}]",ex); break; case QQActionEventType.EVT_CANCELED: MyLogger.Default.Info($"{GetType().Name} [type={type.GetDescription()}, target={target}]"); break; default: MyLogger.Default.Debug($"{GetType().Name} [type={type.GetDescription()}, target={target}]"); break; } Listener?.Invoke(ActionFuture, new QQActionEvent(type, target)); }
public QQActionEvent(QQActionEventType type, object target) { Type = type; Target = target; }
public virtual void NotifyActionEvent(QQActionEventType type, object target) { switch (type) { case QQActionEventType.EvtError: { var ex = (QQException)target; Context.Logger.LogError($"[Action={GetType().Name}, Type={type}, {ex}"); Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.NetError, ex)); break; } case QQActionEventType.EvtRetry: { var ex = (QQException)target; Context.Logger.LogWarning($"[Action={GetType().Name}, Type={type}, RetryTimes={_retryTimes}][{ex.ToSimpleString()}]"); break; } case QQActionEventType.EvtCanceled: { Context.Logger.LogInformation($"[Action={GetType().Name}, Type={type}, Target={target}]"); break; } default: { Context.Logger.LogDebug($"[Action={GetType().Name}, Type={type}"); break; } } Listener?.Invoke(this, new QQActionEvent(type, target)); }
public void NotifyActionEvent(QQActionEventType type, object target) { Listener?.Invoke(this, new QQActionEvent(type, target)); }