diff --git a/plugs/core/core.plug.yaml b/plugs/core/core.plug.yaml index 617d147..574ab5c 100644 --- a/plugs/core/core.plug.yaml +++ b/plugs/core/core.plug.yaml @@ -374,11 +374,9 @@ functions: showLogsCommand: path: ./debug.ts:showLogsCommand command: - name: "Debug: Show Logs" + name: "Show Logs" key: "Ctrl-Alt-l" mac: "Cmd-Alt-l" - events: - - log:reload hideBhsCommand: path: ./debug.ts:hideBhsCommand command: diff --git a/plugs/core/debug.ts b/plugs/core/debug.ts index 93d2eed..ccfa62c 100644 --- a/plugs/core/debug.ts +++ b/plugs/core/debug.ts @@ -1,10 +1,4 @@ -import { sandbox } from "$sb/plugos-syscall/mod.ts"; -import { - editor, - markdown, - sandbox as serverSandbox, - system, -} from "$sb/silverbullet-syscall/mod.ts"; +import { editor, markdown } from "$sb/silverbullet-syscall/mod.ts"; export async function parsePageCommand() { console.log( @@ -18,22 +12,13 @@ export async function parsePageCommand() { } export async function showLogsCommand() { - // Running in client/server mode? - const clientServer = !!(await system.getEnv()); - - if (clientServer) { - const clientLogs = await sandbox.getLogs(); - const serverLogs = await serverSandbox.getServerLogs(); - await editor.showPanel( - "bhs", - 1, - ` + await editor.showPanel( + "bhs", + 1, + ` -
${ - clientLogs - .map((le) => `[${le.level}] ${le.message}`) - .join("\n") - }-
${ - serverLogs - .map((le) => `[${le.level}] ${le.message}`) - .join("\n") - }-
" + serverLogs.map((le) => "[" + le.level + "] " + le.message).join("\\n") + ""; + } + const clientLogs = await syscall("sandbox.getLogs"); + clientDiv.innerHTML = "
" + clientLogs.map((le) => "[" + le.level + "] " + le.message).join("\\n") + ""; + }).catch(console.error); + }, 1000); + }); `, - ); - } else { - const logs = await sandbox.getLogs(); - await editor.showPanel( - "bhs", - 1, - ` - - - -
${ - logs - .map((le) => `[${le.level}] ${le.message}`) - .join("\n") - }-