@@ -983,7 +983,6 @@ private void ReadToBufferList (ILogFileInfo logFileInfo, long filePos, int start
983983 var lineNum = startLine ;
984984 LogBuffer logBuffer ;
985985
986-
987986 AcquireBufferListUpgradeableReadLock ( ) ;
988987
989988 try
@@ -1054,7 +1053,9 @@ private void ReadToBufferList (ILogFileInfo logFileInfo, long filePos, int start
10541053 var droppedLines = logBuffer . PrevBuffersDroppedLinesSum ;
10551054 filePos = reader . Position ;
10561055
1057- while ( ReadLineMemory ( reader , logBuffer . StartLine + logBuffer . LineCount , logBuffer . StartLine + logBuffer . LineCount + droppedLines , out var line ) )
1056+ var ( success , lineMemory , line ) = ReadLineMemory ( reader , logBuffer . StartLine + logBuffer . LineCount , logBuffer . StartLine + logBuffer . LineCount + droppedLines ) ;
1057+
1058+ while ( success )
10581059 {
10591060 if ( _shouldStop )
10601061 {
@@ -1116,10 +1117,12 @@ private void ReadToBufferList (ILogFileInfo logFileInfo, long filePos, int start
11161117 }
11171118 }
11181119
1119- LogLine logLine = new ( line , logBuffer . StartLine + logBuffer . LineCount ) ;
1120+ LogLine logLine = new ( lineMemory , logBuffer . StartLine + logBuffer . LineCount ) ;
11201121 logBuffer . AddLine ( logLine , filePos ) ;
11211122 filePos = reader . Position ;
11221123 lineNum ++ ;
1124+
1125+ ( success , lineMemory , line ) = ReadLineMemory ( reader , logBuffer . StartLine + logBuffer . LineCount , logBuffer . StartLine + logBuffer . LineCount + droppedLines ) ;
11231126 }
11241127
11251128 logBuffer . Size = filePos - logBuffer . StartPos ;
@@ -1447,7 +1450,9 @@ private void ReReadBuffer (LogBuffer logBuffer)
14471450 var dropCount = logBuffer . PrevBuffersDroppedLinesSum ;
14481451 logBuffer . ClearLines ( ) ;
14491452
1450- while ( ReadLineMemory ( reader , logBuffer . StartLine + logBuffer . LineCount , logBuffer . StartLine + logBuffer . LineCount + dropCount , out var line ) )
1453+ var ( success , lineMemory , line ) = ReadLineMemory ( reader , logBuffer . StartLine + logBuffer . LineCount , logBuffer . StartLine + logBuffer . LineCount + dropCount ) ;
1454+
1455+ while ( success )
14511456 {
14521457 if ( lineCount >= maxLinesCount )
14531458 {
@@ -1460,11 +1465,13 @@ private void ReReadBuffer (LogBuffer logBuffer)
14601465 continue ;
14611466 }
14621467
1463- LogLine logLine = new ( line , logBuffer . StartLine + logBuffer . LineCount ) ;
1468+ LogLine logLine = new ( lineMemory , logBuffer . StartLine + logBuffer . LineCount ) ;
14641469
14651470 logBuffer . AddLine ( logLine , filePos ) ;
14661471 filePos = reader . Position ;
14671472 lineCount ++ ;
1473+
1474+ ( success , lineMemory , line ) = ReadLineMemory ( reader , logBuffer . StartLine + logBuffer . LineCount , logBuffer . StartLine + logBuffer . LineCount + dropCount ) ;
14681475 }
14691476
14701477 if ( maxLinesCount != logBuffer . LineCount )
@@ -1799,21 +1806,26 @@ private bool ReadLine (ILogStreamReader reader, int lineNum, int realLineNum, ou
17991806 return true ;
18001807 }
18011808
1802- private bool ReadLineMemory ( ILogStreamReader reader , int lineNum , int realLineNum , out string outLine )
1809+ private ( bool Success , ReadOnlyMemory < char > LineMemory , string Line ) ReadLineMemory ( ILogStreamReader reader , int lineNum , int realLineNum )
18031810 {
18041811 if ( reader is ILogStreamReaderMemory memoryReader )
18051812 {
18061813 if ( memoryReader . TryReadLine ( out var lineMemory ) )
18071814 {
18081815 var line = lineMemory . ToString ( ) ; // Still converts to string
18091816 // ... preprocessing ...
1817+
1818+ if ( PreProcessColumnizer != null )
1819+ {
1820+ line = PreProcessColumnizer . PreProcessLine ( line , lineNum , realLineNum ) ;
1821+ }
1822+
18101823 memoryReader . ReturnMemory ( lineMemory ) ;
1811- outLine = line ;
1812- return true ;
1824+ return ( true , lineMemory , line ) ;
18131825 }
18141826 }
18151827
1816- return ReadLine ( reader , lineNum , realLineNum , out outLine ) ;
1828+ return ( ReadLine ( reader , lineNum , realLineNum , out var outLine ) , null , outLine ) ;
18171829 }
18181830
18191831 private void AcquireBufferListUpgradeableReadLock ( )
0 commit comments