fix(logging): trim provider log prefixes

This commit is contained in:
Peter Steinberger
2026-01-02 00:15:01 +00:00
parent 464dabdc16
commit 4ec020a86d
5 changed files with 15 additions and 21 deletions

View File

@@ -199,7 +199,7 @@ describe("telegram inbound media", () => {
expect(replySpy).not.toHaveBeenCalled();
expect(runtimeError).toHaveBeenCalledTimes(1);
const msg = String(runtimeError.mock.calls[0]?.[0] ?? "");
expect(msg).toContain("Telegram handler failed:");
expect(msg).toContain("handler failed:");
expect(msg).toContain("file_path");
fetchSpy.mockRestore();

View File

@@ -201,7 +201,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
bot,
});
} catch (err) {
runtime.error?.(danger(`Telegram handler failed: ${String(err)}`));
runtime.error?.(danger(`handler failed: ${String(err)}`));
}
});
@@ -225,7 +225,7 @@ async function deliverReplies(params: {
const { replies, chatId, runtime, bot } = params;
for (const reply of replies) {
if (!reply?.text && !reply?.mediaUrl && !(reply?.mediaUrls?.length ?? 0)) {
runtime.error?.(danger("Telegram reply missing text/media"));
runtime.error?.(danger("reply missing text/media"));
continue;
}
const mediaList = reply.mediaUrls?.length

View File

@@ -46,9 +46,7 @@ export async function startTelegramWebhook(opts: {
const handled = handler(req, res);
if (handled && typeof (handled as Promise<void>).catch === "function") {
void (handled as Promise<void>).catch((err) => {
runtime.log?.(
`Telegram webhook handler failed: ${formatErrorMessage(err)}`,
);
runtime.log?.(`webhook handler failed: ${formatErrorMessage(err)}`);
if (!res.headersSent) res.writeHead(500);
res.end();
});
@@ -64,7 +62,7 @@ export async function startTelegramWebhook(opts: {
});
await new Promise<void>((resolve) => server.listen(port, host, resolve));
runtime.log?.(`Telegram webhook listening on ${publicUrl}`);
runtime.log?.(`webhook listening on ${publicUrl}`);
const shutdown = () => {
server.close();