public void ErrorEvent()
        {
            _persister.AddErrorEvent(_errorEvent);
            _persister.Dispose();
            var writer = _writerFactory.GetOneWriterAndVerifyOthersAreEmptyAndDisposed <BackgrounderJobError>("BackgrounderJobErrors", 4);

            writer.ReceivedObjects.Count.Should().Be(1);
            writer.ReceivedObjects[0].Should().BeEquivalentTo(_errorEvent);
        }
        public void ParseAndPersistLine(LogLine logLine, string logLineText)
        {
            if (logLineText == null || logLine == null)
            {
                _processingNotificationsCollector.ReportError($"{nameof(BackgrounderEventParser)} received null log line or log string", logLine, nameof(BackgrounderPlugin));
                return;
            }

            var backgrounderId = GetBackgrounderId(logLine);

            var lineMatch = NewBackgrounderRegex.Match(logLineText);

            if (!lineMatch.Success)
            {
                _processingNotificationsCollector.ReportError($"Failed to process string as Backgrounder event. This is expected for logs prior to 10.4", logLine, nameof(BackgrounderPlugin));
                return;
            }

            var errorEvent = ParseErrorMessage(lineMatch, logLine);

            if (errorEvent != null)
            {
                _backgrounderEventPersister.AddErrorEvent(errorEvent);
                return;
            }

            if (!int.TryParse(lineMatch.Groups["job_id"].Value, out var jobId))
            {
                return; // We only allow error messages to not have job id
            }

            var startEvent = TryMatchStartMessage(lineMatch, logLine, backgrounderId, jobId);

            if (startEvent != null)
            {
                _backgrounderEventPersister.AddStartEvent(startEvent);
                return;
            }

            var endEvent = TryMatchEndMessage(lineMatch, logLine, jobId);

            if (endEvent != null)
            {
                _backgrounderEventPersister.AddEndEvent(endEvent);
                return;
            }

            var extractJobDetails = TryMatchExtractJobDetails(lineMatch, jobId, logLine);

            if (extractJobDetails != null)
            {
                _backgrounderEventPersister.AddExtractJobDetails(extractJobDetails);
                return;
            }

            var subscriptionJobDetails = TryMatchSubscriptionJobDetails(lineMatch, jobId);

            if (subscriptionJobDetails != null)
            {
                _backgrounderEventPersister.AddSubscriptionJobDetails(subscriptionJobDetails);
                return;
            }
        }