aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Utils.ts16
-rw-r--r--src/server/DashSession/DashSessionAgent.ts13
2 files changed, 16 insertions, 13 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 29fce3409..9e3db9e06 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -26,6 +26,22 @@ export namespace Utils {
return { scale, translateX, translateY };
}
+ export function TraceConsoleLog() {
+ ['log', 'warn'].forEach(function (method) {
+ const old = (console as any)[method];
+ (console as any)[method] = function () {
+ let stack = new Error("").stack?.split(/\n/);
+ // Chrome includes a single "Error" line, FF doesn't.
+ if (stack && stack[0].indexOf('Error') === 0) {
+ stack = stack.slice(1);
+ }
+ const message = (stack?.[1] || "Stack undefined!").trim();
+ const args = ([] as any[]).slice.apply(arguments).concat([message]);
+ return old.apply(console, args);
+ };
+ });
+ }
+
/**
* A convenience method. Prepends the full path (i.e. http://localhost:1050) to the
* requested extension
diff --git a/src/server/DashSession/DashSessionAgent.ts b/src/server/DashSession/DashSessionAgent.ts
index 7ecc6ec76..d61e9aac1 100644
--- a/src/server/DashSession/DashSessionAgent.ts
+++ b/src/server/DashSession/DashSessionAgent.ts
@@ -26,19 +26,6 @@ export class DashSessionAgent extends AppliedSessionAgent {
* Installs event hooks, repl commands and additional IPC listeners.
*/
protected async initializeMonitor(monitor: Monitor): Promise<string> {
- // ['log', 'warn'].forEach(function (method) {
- // const old = (console as any)[method];
- // (console as any)[method] = function () {
- // let stack = new Error("").stack?.split(/\n/);
- // // Chrome includes a single "Error" line, FF doesn't.
- // if (stack && stack[0].indexOf('Error') === 0) {
- // stack = stack.slice(1);
- // }
- // const message = (stack?.[1] || "Stack undefined!").trim();
- // const args = ([] as any[]).slice.apply(arguments).concat([message]);
- // return old.apply(console, args);
- // };
- // });
const sessionKey = Utils.GenerateGuid();
await this.dispatchSessionPassword(sessionKey);
monitor.addReplCommand("pull", [], () => monitor.exec("git pull"));