message: Remove some duplicate/unformatted logs from end of deploy output
diff: @@ -18,7 +18,7 @@ export async function waitForDeploymentToComplete(context: IActionContext & Part
  let fullLog: string = '';
  let lastLogTime: Date = new Date(0);
  - let lastLine: string = '';
  + let lastErrorLine: string = '';
  let initialStartTime: Date | undefined;
  let deployment: KuduModels.DeployResult | undefined;
  let permanentId: string | undefined;
  @@ -57,14 +57,16 @@ export async function waitForDeploymentToComplete(context: IActionContext & Part
  fullLog = fullLog.concat(newEntry.message);
  ext.outputChannel.appendLog(newEntry.message, { date: newEntry.logTime, resourceName: client.fullName });
  lastLogTimeForThisPoll = newEntry.logTime;
  - lastLine = newEntry.message;
  + if (/error/i.test(newEntry.message)) {
  + lastErrorLine = newEntry.message;
  + }
  }
  await retryKuduCall(context, 'getLogEntryDetails', async () => {
  await ignore404Error(context, async () => {
  if (newEntry.id && newEntry.detailsUrl) {
  const details: KuduModels.LogEntry[] = await kuduClient.deployment.getLogEntryDetails(deploymentId, newEntry.id);
  - logEntries.push(...details.reverse());
  + logEntries.push(...cleanDetails(details));
  }
  });
  });
  @@ -89,7 +91,7 @@ export async function waitForDeploymentToComplete(context: IActionContext & Part
  ext.outputChannel.appendLog(messageWithoutName, { resourceName: client.fullName });
  context.errorHandling.suppressDisplay = true;
  // Hopefully the last line is enough to give us an idea why deployments are failing without excessively tracking everything
  - context.telemetry.properties.deployErrorLastLine = lastLine;
  + context.telemetry.properties.deployErrorLastLine = lastErrorLine;
  throw new Error(messageWithoutName);
  } else {
  context.syncTriggersPostDeploy = client.isFunctionApp && !/syncing/i.test(fullLog);
  @@ -166,3 +168,24 @@ async function tryGetLatestDeployment(context: IActionContext, kuduClient: KuduC
  return [deployment, permanentId, initialStartTime];
  }
  +
  +/**
  + * Workaround for some weird Oryx behavior where it shows several duplicate logs on a single line
  + */
  +function cleanDetails(entries: KuduModels.LogEntry[]): KuduModels.LogEntry[] {
  + const result: KuduModels.LogEntry[] = [];
  + for (const entry of entries) {
  + const oryxEOL: string = '\\n';
  + if (entry.message?.includes(oryxEOL)) {
  + const newMessages: string[] = entry.message.split(oryxEOL);
  + for (const newMessage of newMessages) {
  + if (!entries.find(d => d.message === newMessage)) {
  + result.push({ ...entry, message: newMessage });
  + }
  + }
  + } else {
  + result.push(entry);
  + }
  + }
  + return result.reverse();
  +}
  