From 67e4884d4a908441e66cd32001215d888ab12087 Mon Sep 17 00:00:00 2001 From: Rafael Tapia Date: Thu, 28 Dec 2023 15:03:29 -0300 Subject: [PATCH] fix: add new instance of logger --- deno-runtime/main.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deno-runtime/main.ts b/deno-runtime/main.ts index 4c779e2b4..c0affec9d 100644 --- a/deno-runtime/main.ts +++ b/deno-runtime/main.ts @@ -9,6 +9,7 @@ if (!Deno.args.includes('--subprocess')) { } import { JsonRpcError } from 'jsonrpc-lite'; +import type { App } from "@rocket.chat/apps-engine/definition/App.ts"; import * as Messenger from './lib/messenger.ts'; import { AppObjectRegistry } from './AppObjectRegistry.ts'; @@ -43,6 +44,13 @@ async function requestRouter({ type, payload }: Messenger.JsonRpcRequest): Promi const logger = new Logger(method); AppObjectRegistry.set('logger', logger); + const app = AppObjectRegistry.get('app'); + + if (app) { + // Same logic as applied in the ProxiedApp class previously + (app as unknown as Record).logger = logger; + } + const [methodPrefix] = method.split(':') as [keyof Handlers]; const handler = methodHandlers[methodPrefix]