-
-
Notifications
You must be signed in to change notification settings - Fork 170
Improve Server Log DX #1085
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
Merged
Merged
Improve Server Log DX #1085
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c1a9a11
clean up extra public assets
chelojimenez 5a9aa1e
clean up banner
chelojimenez a898a02
add verbose flag
chelojimenez 821d776
update docs
chelojimenez dd816cf
use new util to log to server
chelojimenez 27a52af
add verbose to our code api
chelojimenez c2d0cda
prettier
chelojimenez 8c2903b
Merge remote-tracking branch 'origin/main' into improve-start-ux
chelojimenez a679901
rm double log
chelojimenez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # AGENTS.md | ||
|
|
||
| Instructions for AI coding agents working on this codebase. | ||
|
|
||
| ## Logging | ||
|
|
||
| **Do not use `console.log`, `console.warn`, or `console.error` directly.** | ||
|
|
||
| ### Server code (`server/`) | ||
|
|
||
| Use the centralized logger utility: | ||
|
|
||
| ```typescript | ||
| import { logger } from "@/utils/logger"; | ||
|
|
||
| logger.error("Something failed", error, { userId: "123" }); | ||
| logger.warn("Deprecated API used", { endpoint: "/old" }); | ||
| logger.info("Server started"); | ||
| logger.debug("Processing request", requestData); | ||
| ``` | ||
|
|
||
| **Why?** The logger sends errors/warnings to Sentry and respects the `--verbose` flag (silent in production by default). | ||
|
|
||
| ### CLI script (`bin/start.js`) | ||
|
|
||
| Use the built-in colored logging functions: | ||
|
|
||
| ```javascript | ||
| logSuccess("Server started"); // ✅ green | ||
| logInfo("Using port 6274"); // ℹ️ blue | ||
| logWarning("Port in use"); // ⚠️ yellow | ||
| logError("Failed to start"); // ❌ red | ||
| logStep("Build", "Compiling..."); // [Build] cyan header | ||
| logProgress("Waiting..."); // ⏳ magenta | ||
| logDivider(); // ── dim line | ||
| logBox("http://localhost:6274", "MCPJam"); // boxed output | ||
| ``` | ||
|
|
||
| For verbose-only output (hidden unless `--verbose` flag): | ||
|
|
||
| ```javascript | ||
| verboseInfo("Loading config..."); | ||
| verboseSuccess("Config loaded"); | ||
| verboseStep("Setup", "Initializing..."); | ||
| ``` | ||
|
|
||
| ### Client code | ||
|
|
||
| Browser `console.*` is acceptable for client-side debugging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verbose logging may leak secrets via custom header values; redact by key.
Even in verbose mode, printing raw header values (especially cookies/tokens) is risky in shared terminals/log captures.
Also applies to: 421-425, 549-552