Transfer multiline log messages from Node to .NET without treating each line as a separate log entry

This commit is contained in:
SteveSandersonMS
2016-07-18 16:34:36 +01:00
parent f4efcacd40
commit fae0a886af
6 changed files with 161 additions and 26 deletions

View File

@@ -168,6 +168,18 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
return process;
}
private static string UnencodeNewlines(string str)
{
if (str != null)
{
// The token here needs to match the const in OverrideStdOutputs.ts.
// See the comment there for why we're doing this.
str = str.Replace("__ns_newline__", Environment.NewLine);
}
return str;
}
private void ConnectToInputOutputStreams()
{
var initializationIsCompleted = false;
@@ -181,7 +193,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
}
else if (evt.Data != null)
{
OnOutputDataReceived(evt.Data);
OnOutputDataReceived(UnencodeNewlines(evt.Data));
}
};
@@ -197,7 +209,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
}
else
{
OnErrorDataReceived(evt.Data);
OnErrorDataReceived(UnencodeNewlines(evt.Data));
}
}
};