//private fields
        //primary constructor
        public RdLogEvent(
            RdLogEventType type,
            RdLogEventMode mode,
            [NotNull] string message,
            [NotNull] string stackTrace
            )
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            if (stackTrace == null)
            {
                throw new ArgumentNullException("stackTrace");
            }

            Type       = type;
            Mode       = mode;
            Message    = message;
            StackTrace = stackTrace;
        }
示例#2
0
        private void ApplicationOnLogMessageReceived(string message, string stackTrace, LogType type)
        {
            if (!PluginSettings.LogEventsCollectorEnabled) // stop collecting, if setting was disabled
            {
                return;
            }

            RdLogEventType eventType;

            switch (type)
            {
            case LogType.Error:
            case LogType.Exception:
                eventType = RdLogEventType.Error;
                break;

            case LogType.Warning:
                eventType = RdLogEventType.Warning;
                break;

            default:
                eventType = RdLogEventType.Message;
                break;
            }

            RdLogEventMode mode = RdLogEventMode.Play;

            if (PluginEntryPoint.PlayModeSavedState == PluginEntryPoint.PlayModeState.Stopped)
            {
                mode = RdLogEventMode.Edit;
            }

            var ticks = DateTime.UtcNow.Ticks;
            var evt   = new RdLogEvent(ticks, eventType, mode, message, stackTrace);

            DelayedLogEvents.Enqueue(evt);
            OnAddEvent(new EventArgs());
        }