fix(logging): trim provider log prefixes
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user