Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug logs to troubleshoot the creation of the Indiekit/Express server and the connection to MongoDB #750

Closed
wants to merge 5 commits into from

Conversation

jackdbd
Copy link
Contributor

@jackdbd jackdbd commented Jun 6, 2024

I think it's useful to understand what's happening in the bootstrap method of the Indiekit class, and in general when Indiekit creates the Express server and connects to a MongoDB database. A few debug logs placed in key phases of the server creation and database connection phases can help a long way. For example, some time ago I spent some time trying to figure out why Indiekit would not connect to MongoDB.

The debug logs of this PR can be selectively enabled by setting the DEBUG environment variable:

DEBUG=indiekit:index,indiekit:express,indiekit:mongodb

Copy link
Collaborator

@paulrobertlloyd paulrobertlloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few tweaks, but this looks very helpful for debugging. Want to make sure not overly noisy, are all these messages useful? (I think there’s a way to set log level for a given message, maybe at some point we should do that?)

packages/indiekit/config/express.js Show resolved Hide resolved
packages/indiekit/index.js Outdated Show resolved Hide resolved
packages/indiekit/index.js Outdated Show resolved Hide resolved
packages/indiekit/index.js Outdated Show resolved Hide resolved
Co-authored-by: Paul Robert Lloyd <[email protected]>
@paulrobertlloyd
Copy link
Collaborator

Had to create a this PR in #758 so that I could merge this change. Thanks @jackdbd!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants