Skip to content

Commit

Permalink
fix: add new instance of logger
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael committed Dec 28, 2023
1 parent 9c05b9c commit 67e4884
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deno-runtime/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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>('app');

if (app) {
// Same logic as applied in the ProxiedApp class previously
(app as unknown as Record<string, unknown>).logger = logger;
}

const [methodPrefix] = method.split(':') as [keyof Handlers];
const handler = methodHandlers[methodPrefix]

Expand Down

0 comments on commit 67e4884

Please sign in to comment.