-
Notifications
You must be signed in to change notification settings - Fork 772
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
Intercept workerd logs + write all debug logs to a hidden file #4341
Conversation
🦋 Changeset detectedLatest commit: 664e4a4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6932507257/npm-package-wrangler-4341 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6932507257/npm-package-wrangler-4341 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6932507257/npm-package-wrangler-4341 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6932507257/npm-package-miniflare-4341 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6932507257/npm-package-cloudflare-pages-shared-4341 Note that these links will no longer work once the GitHub Actions artifact expires.
| Please ensure constraints are pinned, and |
8e8c776
to
2cc622d
Compare
@RamIdeas are users notified somewhere that this new file exists? |
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.
Miniflare changes look good! I've added some comments to some of the Wrangler ones... 👍
5cd8f27
to
be11679
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4341 +/- ##
==========================================
- Coverage 75.46% 75.23% -0.24%
==========================================
Files 225 226 +1
Lines 12482 12555 +73
Branches 3242 3256 +14
==========================================
+ Hits 9420 9446 +26
- Misses 3062 3109 +47
|
e36ad5f
to
92346bc
Compare
7461576
to
5fc8dac
Compare
when the log level means it won't be logged
allowing wrangler to decide whether workerd logs should reach the terminal
for WRANGLER_LOG_DIR
as well as on startup
5fc8dac
to
6b6ecdd
Compare
export function readDebugLogFile(): Promise<string> { | ||
return mutex.runWith(() => readFile(debugLogFilepath, "utf-8")); | ||
} |
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.
Is this function used anywhere?
a894b61
to
67b8104
Compare
WRANGLER_LOG=debug will continue to log to the terminal
67b8104
to
664e4a4
Compare
Fixes #3631
What this PR solves / how to test:
handleRuntimeStdio
which allows intercepting workerdstdout
/stderr
debuglogs to.wrangler/debug-logs/wrangler-debug-<TIMESTAMP>.log
(superseding this PR)Implementation notes:
debug
are now never sent to the terminal so the terminal remains clean but the extra observability is provided via the log fileWRANGLER_LOG_DIR
env var.log
filepath<package>/.wrangler/debug-logs
WRANGLER_LOG_DIR
value ends in.log
debug
is what triggers the use of the log file but all logs are appended to the log file so that the order amongst other log-level logs (info
,error
,warn
, etc) is preservedExposing a
handleRuntimeStdio
option, instead of hooks for each readline interface of the current implementation, should also satisfy #4357Author has addressed the following:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr review
so future reviewers can take inspiration and learn from it.