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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
@ -31,6 +32,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DebugProxy.Hosting
|
||||||
{
|
{
|
||||||
config.AddCommandLine(args);
|
config.AddCommandLine(args);
|
||||||
}
|
}
|
||||||
|
config.SetBasePath(Directory.GetCurrentDirectory());
|
||||||
config.AddJsonFile("blazor-debugproxysettings.json", optional: true, reloadOnChange: true);
|
config.AddJsonFile("blazor-debugproxysettings.json", optional: true, reloadOnChange: true);
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
|
|
|
||||||
|
|
@ -320,10 +320,10 @@ namespace WebAssembly.Net.Debugging {
|
||||||
{
|
{
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
case "protocol":
|
case "protocol":
|
||||||
//logger.LogTrace (msg);
|
logger.LogTrace (msg);
|
||||||
break;
|
break;
|
||||||
case "verbose":
|
case "verbose":
|
||||||
//logger.LogDebug (msg);
|
logger.LogDebug (msg);
|
||||||
break;
|
break;
|
||||||
case "info":
|
case "info":
|
||||||
case "warning":
|
case "warning":
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ namespace Microsoft.AspNetCore.Builder
|
||||||
RemoveUnwantedEnvironmentVariables(processStartInfo.Environment);
|
RemoveUnwantedEnvironmentVariables(processStartInfo.Environment);
|
||||||
|
|
||||||
var debugProxyProcess = Process.Start(processStartInfo);
|
var debugProxyProcess = Process.Start(processStartInfo);
|
||||||
|
PassThroughConsoleOutput(debugProxyProcess);
|
||||||
CompleteTaskWhenServerIsReady(debugProxyProcess, tcs);
|
CompleteTaskWhenServerIsReady(debugProxyProcess, tcs);
|
||||||
|
|
||||||
new CancellationTokenSource(DebugProxyLaunchTimeout).Token.Register(() =>
|
new CancellationTokenSource(DebugProxyLaunchTimeout).Token.Register(() =>
|
||||||
|
|
@ -97,6 +98,14 @@ namespace Microsoft.AspNetCore.Builder
|
||||||
return debugProxyPath;
|
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)
|
private static void CompleteTaskWhenServerIsReady(Process aspNetProcess, TaskCompletionSource<string> taskCompletionSource)
|
||||||
{
|
{
|
||||||
string capturedUrl = null;
|
string capturedUrl = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue