Skip to content

Commit 32bcfa9

Browse files
committed
Restore logging
1 parent cf735fa commit 32bcfa9

File tree

9 files changed

+31
-35
lines changed

9 files changed

+31
-35
lines changed

src/ElectronNET.API/Common/ProcessRunner.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ private void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
536536

537537
if (e.Data != null)
538538
{
539-
System.Diagnostics.Debug.WriteLine(e.Data);
539+
Console.WriteLine("|| " + e.Data);
540540
}
541541
else
542542
{
@@ -570,7 +570,7 @@ private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
570570

571571
if (e.Data != null)
572572
{
573-
System.Diagnostics.Debug.WriteLine(e.Data);
573+
Console.WriteLine("|| " + e.Data);
574574
}
575575
else
576576
{

src/ElectronNET.API/Runtime/Helpers/LaunchOrderDetector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public static bool CheckIsLaunchedByDotNet()
3232
}
3333
}
3434

35-
// Debug trace - useful for diagnostics
36-
System.Diagnostics.Debug.WriteLine($"Probe scored for launch origin: DotNet {scoreDotNet} vs. {scoreElectron} Electron");
35+
Console.WriteLine("Probe scored for launch origin: DotNet {0} vs. {1} Electron", scoreDotNet, scoreElectron);
3736
return scoreDotNet > scoreElectron;
3837
}
3938

src/ElectronNET.API/Runtime/Helpers/UnpackagedDetector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public static bool CheckIsUnpackaged()
3838
}
3939
}
4040

41-
// Debug trace - useful for diagnostics
42-
System.Diagnostics.Debug.WriteLine($"Probe scored for package mode: Unpackaged {scoreUnpackaged} vs. {scorePackaged} Packaged");
41+
Console.WriteLine("Probe scored for package mode: Unpackaged {0} vs. {1} Packaged", scoreUnpackaged, scorePackaged);
4342
return scoreUnpackaged > scorePackaged;
4443
}
4544

src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,21 @@ private async Task StartInternal(string startCmd, string args, string directoriy
161161
{
162162
await Task.Delay(10.ms()).ConfigureAwait(false);
163163

164-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: startCmd: {startCmd}");
165-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: args: {args}");
164+
Console.Error.WriteLine("[StartInternal]: startCmd: {0}", startCmd);
165+
Console.Error.WriteLine("[StartInternal]: args: {0}", args);
166166

167167
this.process = new ProcessRunner("ElectronRunner");
168168
this.process.ProcessExited += this.Process_Exited;
169169
this.process.Run(startCmd, args, directoriy);
170170

171171
await Task.Delay(500.ms()).ConfigureAwait(false);
172172

173+
Console.Error.WriteLine("[StartInternal]: after run:");
174+
173175
if (!this.process.IsRunning)
174176
{
175-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Process is not running: {this.process.StandardError}");
176-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Process is not running: {this.process.StandardOutput}");
177+
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardError);
178+
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardOutput);
177179

178180
Task.Run(() => this.TransitionState(LifetimeState.Stopped));
179181

@@ -184,9 +186,9 @@ private async Task StartInternal(string startCmd, string args, string directoriy
184186
}
185187
catch (Exception ex)
186188
{
187-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {this.process?.StandardError}");
188-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {this.process?.StandardOutput}");
189-
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {ex}");
189+
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardError);
190+
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardOutput);
191+
Console.Error.WriteLine("[StartInternal]: Exception: " + ex);
190192
throw;
191193
}
192194
}

src/ElectronNET.API/Runtime/StartupManager.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ internal class StartupManager
1313
{
1414
public void Initialize()
1515
{
16-
var startTime = System.Diagnostics.Stopwatch.StartNew();
17-
1816
try
1917
{
2018
ElectronNetRuntime.BuildInfo = this.GatherBuildInfo();
21-
System.Diagnostics.Debug.WriteLine($"[Startup] GatherBuildInfo: {startTime.ElapsedMilliseconds}ms");
2219
}
2320
catch (Exception ex)
2421
{
@@ -27,18 +24,13 @@ public void Initialize()
2724

2825
this.CollectProcessData();
2926
this.SetElectronExecutable();
30-
System.Diagnostics.Debug.WriteLine($"[Startup] CollectProcessData+SetElectronExecutable: {startTime.ElapsedMilliseconds}ms");
3127

3228
ElectronNetRuntime.StartupMethod = this.DetectAppTypeAndStartup();
33-
System.Diagnostics.Debug.WriteLine($"Evaluated StartupMethod: {ElectronNetRuntime.StartupMethod}");
34-
System.Diagnostics.Debug.WriteLine($"[Startup] DetectAppTypeAndStartup: {startTime.ElapsedMilliseconds}ms");
3529

3630
if (ElectronNetRuntime.DotnetAppType != DotnetAppType.AspNetCoreApp)
3731
{
3832
ElectronNetRuntime.RuntimeControllerCore = this.CreateRuntimeController();
3933
}
40-
41-
System.Diagnostics.Debug.WriteLine($"[Startup] Total StartupManager.Initialize: {startTime.ElapsedMilliseconds}ms");
4234
}
4335

4436
private RuntimeControllerBase CreateRuntimeController()
@@ -142,18 +134,18 @@ private BuildInfo GatherBuildInfo()
142134

143135
if (electronAssembly == null)
144136
{
145-
System.Diagnostics.Debug.WriteLine("GatherBuildInfo: Early exit");
137+
Console.WriteLine("GatherBuildInfo: Early exit");
146138
return buildInfo;
147139
}
148140

149141
if (electronAssembly.GetName().Name == "testhost" || electronAssembly.GetName().Name == "ReSharperTestRunner")
150142
{
151-
System.Diagnostics.Debug.WriteLine("GatherBuildInfo: Detected testhost");
143+
Console.WriteLine("GatherBuildInfo: Detected testhost");
152144
electronAssembly = AppDomain.CurrentDomain.GetData("ElectronTestAssembly") as Assembly ?? electronAssembly;
153145
}
154146
else
155147
{
156-
System.Diagnostics.Debug.WriteLine("GatherBuildInfo: No testhost detected: " + electronAssembly.GetName().Name);
148+
Console.WriteLine("GatherBuildInfo: No testhost detected: " + electronAssembly.GetName().Name);
157149
}
158150

159151
var attributes = electronAssembly.GetCustomAttributes<AssemblyMetadataAttribute>().ToList();

src/ElectronNET.AspNet/Runtime/Services/AspNetLifetimeAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ protected override Task StopCore()
2424
return Task.CompletedTask;
2525
}
2626
}
27-
}
27+
}

src/ElectronNET.Host/api/browserWindows.js

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ElectronNET.Host/api/browserWindows.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ElectronNET.Host/api/browserWindows.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,14 @@ export = (socket: Socket, app: Electron.App) => {
310310

311311
if (loadUrl) {
312312
// Append authentication token to initial URL if available
313-
let urlToLoad = loadUrl;
314-
if ((global as any).authToken) {
313+
const token = global["authToken"];
314+
315+
if (token) {
315316
const separator = loadUrl.includes("?") ? "&" : "?";
316-
urlToLoad = `${loadUrl}${separator}token=${(global as any).authToken}`;
317+
window.loadURL(`${loadUrl}${separator}token=${token}`);
318+
} else {
319+
window.loadURL(loadUrl);
317320
}
318-
window.loadURL(urlToLoad);
319321
}
320322

321323
if (

0 commit comments

Comments
 (0)