private void AppendHeaderBytes(ByteArray buffer, string pri, LogEventInfo logEvent, EncodingSet encodings) { var timestamp = string.Format(CultureInfo.InvariantCulture, TimestampFormat, logEvent.TimeStamp); var hostname = hostnamePolicySet.Apply(hostnameLayout.Render(logEvent)); var appName = appNamePolicySet.Apply(appNameLayout.Render(logEvent)); var procId = procIdPolicySet.Apply(procIdLayout.Render(logEvent)); var msgId = msgIdPolicySet.Apply(msgIdLayout.Render(logEvent)); var header = $"{pri}{version} {timestamp} {hostname} {appName} {procId} {msgId}"; var headerBytes = encodings.Ascii.GetBytes(header); buffer.Append(headerBytes); }
private void AppendHeader(ByteArray buffer, string pri, LogEventInfo logEvent) { var timestamp = string.Format(CultureInfo.InvariantCulture, TimestampFormat, logEvent.TimeStamp); var hostname = hostnamePolicySet.Apply(hostnameLayout.Render(logEvent)); var appName = appNamePolicySet.Apply(appNameLayout.Render(logEvent)); var procId = procIdPolicySet.Apply(procIdLayout.Render(logEvent)); var msgId = msgIdPolicySet.Apply(msgIdLayout.Render(logEvent)); buffer.AppendAscii(pri); buffer.AppendAscii(version); buffer.AppendBytes(SpaceBytes); buffer.AppendAscii(timestamp); buffer.AppendBytes(SpaceBytes); buffer.AppendAscii(hostname); buffer.AppendBytes(SpaceBytes); buffer.AppendAscii(appName); buffer.AppendBytes(SpaceBytes); buffer.AppendAscii(procId); buffer.AppendBytes(SpaceBytes); buffer.AppendAscii(msgId); }