added stack trace to some logging

This commit is contained in:
jackiettran
2025-12-25 18:41:42 -05:00
parent b02ec19d5c
commit 76e4039ba8
15 changed files with 307 additions and 173 deletions

View File

@@ -372,10 +372,17 @@ router.post("/", authenticateToken, requireVerifiedEmail, async (req, res, next)
itemWithOwner.owner,
itemWithOwner
);
console.log(`First listing celebration email sent to owner ${req.user.id}`);
const reqLogger = logger.withRequestId(req.id);
reqLogger.info("First listing celebration email sent", { ownerId: req.user.id });
} catch (emailError) {
// Log but don't fail the item creation
console.error('Failed to send first listing celebration email:', emailError.message);
const reqLogger = logger.withRequestId(req.id);
reqLogger.error('Failed to send first listing celebration email', {
error: emailError.message,
stack: emailError.stack,
ownerId: req.user.id,
itemId: item.id
});
}
}
@@ -571,10 +578,15 @@ router.delete("/admin/:id", authenticateToken, requireAdmin, async (req, res, ne
item,
reason.trim()
);
console.log(`Item deletion notification email sent to owner ${item.ownerId}`);
logger.info("Item deletion notification email sent", { ownerId: item.ownerId, itemId: item.id });
} catch (emailError) {
// Log but don't fail the deletion
console.error('Failed to send item deletion notification email:', emailError.message);
logger.error('Failed to send item deletion notification email', {
error: emailError.message,
stack: emailError.stack,
ownerId: item.ownerId,
itemId: item.id
});
}
const reqLogger = logger.withRequestId(req.id);