import { getLogger } from "../utils/logger.js";

//#region src/auth/session-hooks.ts
const logger = getLogger("auth");
async function logSessionDeletion(session, context) {
	try {
		const userId = session?.userId;
		const sessionId = session?.id;
		const action = context?.path;
		const payload = action ? {
			userId,
			sessionId,
			action
		} : {
			userId,
			sessionId
		};
		logger.info(payload, "Session deleted");
	} catch (err) {
		try {
			logger.warn({ err }, "Failed to log session deletion");
		} catch {}
	}
}

//#endregion
export { logSessionDeletion };