コード例 #1
0
 public void Read()
 {
     invoker.Invoke(() =>
     {
         try
         {
             foreach (var item in File.Read(stream => parser.Parse(stream)))
             {
                 LogEntry(item);
             }
         }
         catch (OutOfBoundsException)
         {
             if (!TryInvokeOutOfBounds())
             {
                 throw;
             }
         }
         catch (Exception e)
         {
             if (!TryInvokeExceptionOccurred(e))
             {
                 throw;
             }
         }
     });
 }
コード例 #2
0
 public IReadOnlyLogEntry Parse(IReadOnlyLogEntry logEntry)
 {
     try
     {
         return(_inner.Parse(logEntry));
     }
     catch (Exception e)
     {
         Log.ErrorFormat("Caught unexpected exception: {0}", e);
         return(logEntry);
     }
 }
コード例 #3
0
        /// <inheritdoc />
        public void GetEntries(IReadOnlyList <LogLineIndex> sourceIndices,
                               ILogBuffer destination,
                               int destinationIndex,
                               LogSourceQueryOptions queryOptions)
        {
            var source = _source;

            if (source != null)
            {
                var columnsToCopy = new IColumnDescriptor[] { Core.Columns.Index, Core.Columns.RawContent };
                var tmp           = new LogBufferArray(sourceIndices.Count, columnsToCopy);
                source.GetEntries(sourceIndices, tmp, 0, queryOptions);

                foreach (var column in columnsToCopy)
                {
                    if (destination.Contains(column))
                    {
                        destination.CopyFrom(column, destinationIndex, tmp, new Int32Range(0, sourceIndices.Count));
                    }
                }

                for (var i = 0; i < sourceIndices.Count; ++i)
                {
                    var parsedLogEntry = _parser.Parse(tmp[i]);
                    if (parsedLogEntry != null)
                    {
                        destination[destinationIndex + i].CopyFrom(parsedLogEntry);
                    }
                    else
                    {
                        destination[destinationIndex + i].CopyFrom(_nothingParsed);
                    }
                }
            }
            else
            {
                destination.FillDefault(destinationIndex, sourceIndices.Count);
            }
        }