Restore logging

This commit is contained in:
Florian Rappl
2026-02-04 11:44:27 +01:00
parent cf735fab4c
commit 32bcfa95ab
9 changed files with 31 additions and 35 deletions

View File

@@ -536,7 +536,7 @@
if (e.Data != null)
{
System.Diagnostics.Debug.WriteLine(e.Data);
Console.WriteLine("|| " + e.Data);
}
else
{
@@ -570,7 +570,7 @@
if (e.Data != null)
{
System.Diagnostics.Debug.WriteLine(e.Data);
Console.WriteLine("|| " + e.Data);
}
else
{

View File

@@ -32,8 +32,7 @@
}
}
// Debug trace - useful for diagnostics
System.Diagnostics.Debug.WriteLine($"Probe scored for launch origin: DotNet {scoreDotNet} vs. {scoreElectron} Electron");
Console.WriteLine("Probe scored for launch origin: DotNet {0} vs. {1} Electron", scoreDotNet, scoreElectron);
return scoreDotNet > scoreElectron;
}

View File

@@ -38,8 +38,7 @@
}
}
// Debug trace - useful for diagnostics
System.Diagnostics.Debug.WriteLine($"Probe scored for package mode: Unpackaged {scoreUnpackaged} vs. {scorePackaged} Packaged");
Console.WriteLine("Probe scored for package mode: Unpackaged {0} vs. {1} Packaged", scoreUnpackaged, scorePackaged);
return scoreUnpackaged > scorePackaged;
}

View File

@@ -161,8 +161,8 @@
{
await Task.Delay(10.ms()).ConfigureAwait(false);
System.Diagnostics.Debug.WriteLine($"[StartInternal]: startCmd: {startCmd}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: args: {args}");
Console.Error.WriteLine("[StartInternal]: startCmd: {0}", startCmd);
Console.Error.WriteLine("[StartInternal]: args: {0}", args);
this.process = new ProcessRunner("ElectronRunner");
this.process.ProcessExited += this.Process_Exited;
@@ -170,10 +170,12 @@
await Task.Delay(500.ms()).ConfigureAwait(false);
Console.Error.WriteLine("[StartInternal]: after run:");
if (!this.process.IsRunning)
{
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Process is not running: {this.process.StandardError}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Process is not running: {this.process.StandardOutput}");
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardError);
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardOutput);
Task.Run(() => this.TransitionState(LifetimeState.Stopped));
@@ -184,9 +186,9 @@
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {this.process?.StandardError}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {this.process?.StandardOutput}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {ex}");
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardError);
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardOutput);
Console.Error.WriteLine("[StartInternal]: Exception: " + ex);
throw;
}
}

View File

@@ -13,12 +13,9 @@
{
public void Initialize()
{
var startTime = System.Diagnostics.Stopwatch.StartNew();
try
{
ElectronNetRuntime.BuildInfo = this.GatherBuildInfo();
System.Diagnostics.Debug.WriteLine($"[Startup] GatherBuildInfo: {startTime.ElapsedMilliseconds}ms");
}
catch (Exception ex)
{
@@ -27,18 +24,13 @@
this.CollectProcessData();
this.SetElectronExecutable();
System.Diagnostics.Debug.WriteLine($"[Startup] CollectProcessData+SetElectronExecutable: {startTime.ElapsedMilliseconds}ms");
ElectronNetRuntime.StartupMethod = this.DetectAppTypeAndStartup();
System.Diagnostics.Debug.WriteLine($"Evaluated StartupMethod: {ElectronNetRuntime.StartupMethod}");
System.Diagnostics.Debug.WriteLine($"[Startup] DetectAppTypeAndStartup: {startTime.ElapsedMilliseconds}ms");
if (ElectronNetRuntime.DotnetAppType != DotnetAppType.AspNetCoreApp)
{
ElectronNetRuntime.RuntimeControllerCore = this.CreateRuntimeController();
}
System.Diagnostics.Debug.WriteLine($"[Startup] Total StartupManager.Initialize: {startTime.ElapsedMilliseconds}ms");
}
private RuntimeControllerBase CreateRuntimeController()
@@ -142,18 +134,18 @@
if (electronAssembly == null)
{
System.Diagnostics.Debug.WriteLine("GatherBuildInfo: Early exit");
Console.WriteLine("GatherBuildInfo: Early exit");
return buildInfo;
}
if (electronAssembly.GetName().Name == "testhost" || electronAssembly.GetName().Name == "ReSharperTestRunner")
{
System.Diagnostics.Debug.WriteLine("GatherBuildInfo: Detected testhost");
Console.WriteLine("GatherBuildInfo: Detected testhost");
electronAssembly = AppDomain.CurrentDomain.GetData("ElectronTestAssembly") as Assembly ?? electronAssembly;
}
else
{
System.Diagnostics.Debug.WriteLine("GatherBuildInfo: No testhost detected: " + electronAssembly.GetName().Name);
Console.WriteLine("GatherBuildInfo: No testhost detected: " + electronAssembly.GetName().Name);
}
var attributes = electronAssembly.GetCustomAttributes<AssemblyMetadataAttribute>().ToList();

View File

@@ -24,4 +24,4 @@
return Task.CompletedTask;
}
}
}
}

View File

@@ -278,12 +278,14 @@ module.exports = (socket, app) => {
});
if (loadUrl) {
// Append authentication token to initial URL if available
let urlToLoad = loadUrl;
if (global.authToken) {
const separator = loadUrl.includes('?') ? '&' : '?';
urlToLoad = `${loadUrl}${separator}token=${global.authToken}`;
const token = global["authToken"];
if (token) {
const separator = loadUrl.includes("?") ? "&" : "?";
window.loadURL(`${loadUrl}${separator}token=${token}`);
}
else {
window.loadURL(loadUrl);
}
window.loadURL(urlToLoad);
}
if (app.commandLine.hasSwitch("clear-cache") &&
app.commandLine.getSwitchValue("clear-cache")) {

File diff suppressed because one or more lines are too long

View File

@@ -310,12 +310,14 @@ export = (socket: Socket, app: Electron.App) => {
if (loadUrl) {
// Append authentication token to initial URL if available
let urlToLoad = loadUrl;
if ((global as any).authToken) {
const token = global["authToken"];
if (token) {
const separator = loadUrl.includes("?") ? "&" : "?";
urlToLoad = `${loadUrl}${separator}token=${(global as any).authToken}`;
window.loadURL(`${loadUrl}${separator}token=${token}`);
} else {
window.loadURL(loadUrl);
}
window.loadURL(urlToLoad);
}
if (