add socket events to emit console messages

This commit is contained in:
rafael-aero
2021-08-25 13:38:30 +02:00
parent 48d5497045
commit 5e82ae4246
2 changed files with 31 additions and 2 deletions

View File

@@ -207,6 +207,27 @@ namespace ElectronNET.API
}
}
/// <summary>
/// Log a message to the console output pipe. This is used when running with "detachedProcess" : true on the electron.manifest.json,
/// as in that case we can't open pipes to read the console output from the child process anymore
/// </summary>
/// <param name="text">Message to log</param>
public static void ConsoleLog(string text)
{
BridgeConnector.Emit("console-stdout", text);
}
/// <summary>
/// Log a message to the console error pipe. This is used when running with "detachedProcess" : true on the electron.manifest.json,
/// as in that case we can't open pipes to read the console output from the child process anymore
/// </summary>
/// <param name="text">Message to log</param>
public static void ConsoleError(string text)
{
BridgeConnector.Emit("console-stderr", text);
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),