Write JSON directly to logfile

Can't be worse than serializing to a string, concatenating and converting to utf8, right?
This commit is contained in:
Bond_009 2024-04-14 23:19:38 +02:00
parent 6fb6b5f176
commit e9ae2d6a1e

View File

@ -492,12 +492,11 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
IODefaults.FileStreamBufferSize,
FileOptions.Asynchronous);
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
await JsonSerializer.SerializeAsync(logStream, state.MediaSource, cancellationToken: cancellationTokenSource.Token).ConfigureAwait(false);
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(
JsonSerializer.Serialize(state.MediaSource)
Environment.NewLine
+ Environment.NewLine
+ Environment.NewLine
+ commandLineLogMessage
+ process.StartInfo.FileName + " " + process.StartInfo.Arguments
+ Environment.NewLine
+ Environment.NewLine);