build(*): Add logging

This commit is contained in:
Josh Creek
2025-04-26 16:07:02 +01:00
parent 900f88f56c
commit 96d43d511c
6 changed files with 282 additions and 12 deletions
+2 -3
View File
@@ -1,13 +1,12 @@
import type * as Party from "partykit/server";
import logger from "../../src/lib/utils/logger";
export default class Server implements Party.Server {
constructor(readonly room: Party.Room) {}
onConnect(conn: Party.Connection, ctx: Party.ConnectionContext) {
// Log connection details
console.log(
`Connected:\n id: ${conn.id}\n room: ${this.room.id}\n url: ${new URL(ctx.request.url).pathname}`
);
logger.info(`Connected:\n id: ${conn.id}\n room: ${this.room.id}\n url: ${new URL(ctx.request.url).pathname}`);
}
onMessage(message: string, sender: Party.Connection) {