Fix logging config and output redirection in DebugProxy (#22157)
* Fix logging config and output redirection in DebugProxy * Log all messages from DebugProxy
This commit is contained in:
parent
53edc767a7
commit
0394a4520e
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -31,6 +32,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DebugProxy.Hosting
|
|||
{
|
||||
config.AddCommandLine(args);
|
||||
}
|
||||
config.SetBasePath(Directory.GetCurrentDirectory());
|
||||
config.AddJsonFile("blazor-debugproxysettings.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureLogging((hostingContext, logging) =>
|
||||
|
|
|
|||
|
|
@ -320,10 +320,10 @@ namespace WebAssembly.Net.Debugging {
|
|||
{
|
||||
switch (priority) {
|
||||
case "protocol":
|
||||
//logger.LogTrace (msg);
|
||||
logger.LogTrace (msg);
|
||||
break;
|
||||
case "verbose":
|
||||
//logger.LogDebug (msg);
|
||||
logger.LogDebug (msg);
|
||||
break;
|
||||
case "info":
|
||||
case "warning":
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ namespace Microsoft.AspNetCore.Builder
|
|||
RemoveUnwantedEnvironmentVariables(processStartInfo.Environment);
|
||||
|
||||
var debugProxyProcess = Process.Start(processStartInfo);
|
||||
PassThroughConsoleOutput(debugProxyProcess);
|
||||
CompleteTaskWhenServerIsReady(debugProxyProcess, tcs);
|
||||
|
||||
new CancellationTokenSource(DebugProxyLaunchTimeout).Token.Register(() =>
|
||||
|
|
@ -97,6 +98,14 @@ namespace Microsoft.AspNetCore.Builder
|
|||
return debugProxyPath;
|
||||
}
|
||||
|
||||
private static void PassThroughConsoleOutput(Process process)
|
||||
{
|
||||
process.OutputDataReceived += (sender, eventArgs) =>
|
||||
{
|
||||
Console.WriteLine(eventArgs.Data);
|
||||
};
|
||||
}
|
||||
|
||||
private static void CompleteTaskWhenServerIsReady(Process aspNetProcess, TaskCompletionSource<string> taskCompletionSource)
|
||||
{
|
||||
string capturedUrl = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue