in src/Serilog.Sinks.AzureDataExplorer/Durable/APayloadReader.cs [42:70]
public TPayload ReadPayload(int batchPostingLimit, long? eventBodyLimitBytes, ref FileSetPosition position, ref int count, string fileName)
{
InitPayLoad(fileName);
using (var current = System.IO.File.Open(position.File, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
var nextLineStart = position.NextLineStart;
while (count < batchPostingLimit && TryReadLine(current, ref nextLineStart, out var nextLine))
{
position = new FileSetPosition(nextLineStart, position.File);
// Count is the indicator that work was done, so advances even in the (rare) case an
// oversized event is dropped.
++count;
if (eventBodyLimitBytes.HasValue && Encoding.UTF8.GetByteCount(nextLine) > eventBodyLimitBytes.Value)
{
SelfLog.WriteLine(
"Event JSON representation exceeds the byte size limit of {0} and will be dropped; data: {1}",
eventBodyLimitBytes, nextLine);
}
else
{
AddToPayLoad(nextLine);
}
}
}
return FinishPayLoad();
}