Skip to content

Commit f42774f

Browse files
celiasclaude
andcommitted
chore: replace console.log/error with log() in test utilities (GAB-31)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 473348c commit f42774f

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

test-discord-image.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { prisma } from "./lib/prisma.ts";
22
import { config } from "./lib/config.ts";
3+
import { log } from "./lib/logger.ts";
34

45
async function main() {
56
const a = await prisma.alert.findFirst({
67
where: { imageUrl: { contains: "i.redd.it" } },
78
select: { imageUrl: true, title: true },
89
});
910
if (!a || !a.imageUrl) {
10-
console.log("No i.redd.it alert found");
11+
log("info", "No i.redd.it alert found");
1112
await prisma.$disconnect();
1213
return;
1314
}
14-
console.log("Sending big image test:", a.imageUrl);
15+
log("info", `Sending big image test: ${a.imageUrl}`);
1516
const res = await fetch(config.DISCORD_WEBHOOK_URL!, {
1617
method: "POST",
1718
headers: { "Content-Type": "application/json" },
@@ -30,7 +31,7 @@ async function main() {
3031
],
3132
}),
3233
});
33-
console.log("Discord:", res.status, res.statusText);
34+
log("info", `Discord: ${res.status} ${res.statusText}`);
3435
await prisma.$disconnect();
3536
}
3637
main();

test-discord.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
import { config } from "./lib/config.ts";
12+
import { log } from "./lib/logger.ts";
1213

1314
async function sendTestEmbed(
1415
label: string,
@@ -52,15 +53,15 @@ async function sendTestEmbed(
5253
});
5354

5455
if (res.ok) {
55-
console.log(`✅ "${label}" sent successfully`);
56+
log("info", `✅ "${label}" sent successfully`);
5657
} else {
57-
console.error(`❌ "${label}" failed — HTTP ${res.status}`);
58+
log("error", `❌ "${label}" failed — HTTP ${res.status}`);
5859
const body = await res.text();
59-
console.error(" Discord said:", body);
60+
log("error", ` Discord said: ${body}`);
6061
}
6162
}
6263

63-
console.log("Sending test embeds to Discord…\n");
64+
log("info", "Sending test embeds to Discord…");
6465

6566
// Send both variants so you can see how each label looks in Discord
6667
await sendTestEmbed("Local post (📍)", true, ["cherry hill", "856"]);
@@ -70,4 +71,4 @@ await new Promise((r) => setTimeout(r, 1500));
7071

7172
await sendTestEmbed("Unknown location (🌐)", false, []);
7273

73-
console.log("\nDone. Check your Discord channel.");
74+
log("info", "Done. Check your Discord channel.");

0 commit comments

Comments
 (0)