Skip to content

Commit a977701

Browse files
authored
Turn on tail logs by default (#11346)
* Turn on tail logs by default * Isolate inspector changes to remote only * Create tricky-starfishes-tap.md * Isolate hotkeys
1 parent 2b4813b commit a977701

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": minor
3+
---
4+
5+
We're soon going to make backend changes that mean that `wrangler dev --remote` sessions will no longer have an associated inspector connection. In advance of these backend changes, we've enabled a new `wrangler tail`-based logging strategy for `wrangler dev --remote`. For now, you can revert to the previous logging strategy with `wrangler dev --remote --no-x-tail-logs`, but in future it will not be possible to revert.
6+
7+
The impact of this will be that logs that were previously available via devtools will now be provided directly to the Wrangler console and it will no longer be possible to interact with the remote Worker via the devtools console.

packages/wrangler/src/api/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export async function unstable_dev(
222222
enableContainers: options?.experimental?.enableContainers ?? false,
223223
dockerPath,
224224
containerEngine: options?.experimental?.containerEngine,
225-
experimentalTailLogs: false,
225+
experimentalTailLogs: true,
226226
};
227227

228228
//outside of test mode, rebuilds work fine, but only one instance of wrangler will work at a time

packages/wrangler/src/api/startDevWorker/ProxyController.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,16 @@ export class ProxyController extends Controller {
401401
// inspector endpoint.
402402
const inVscodeJsDebugTerminal = !!process.env.VSCODE_INSPECTOR_OPTIONS;
403403

404-
return (
405-
this.latestConfig?.dev.inspector !== false &&
406-
!inVscodeJsDebugTerminal &&
407-
!this.latestConfig?.experimental?.tailLogs
408-
);
404+
const shouldEnableInspector =
405+
this.latestConfig?.dev.inspector !== false && !inVscodeJsDebugTerminal;
406+
407+
if (this.latestConfig?.dev.remote) {
408+
// In `wrangler dev --remote`, only enable the inspector if the `--x-tail-logs` flag is disabled
409+
return (
410+
shouldEnableInspector && !this.latestConfig?.experimental?.tailLogs
411+
);
412+
}
413+
return shouldEnableInspector;
409414
}
410415

411416
// ******************

packages/wrangler/src/dev.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ export const dev = createCommand({
260260
alias: ["x-tail-logs"],
261261
describe:
262262
"Experimental: Get runtime logs for the remote worker via Workers Tails rather than the Devtools inspector",
263-
default: false,
263+
default: true,
264+
hidden: true,
264265
},
265266
},
266267
async validateArgs(args) {

packages/wrangler/src/dev/hotkeys.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import type { DevEnv } from "../api";
99

1010
export default function registerDevHotKeys(
1111
devEnvs: DevEnv[],
12-
args: { forceLocal?: boolean; experimentalTailLogs: boolean },
12+
args: {
13+
forceLocal?: boolean;
14+
experimentalTailLogs: boolean;
15+
remote: boolean;
16+
},
1317
render = true
1418
) {
1519
const primaryDevEnv = devEnvs[0];
@@ -28,7 +32,8 @@ export default function registerDevHotKeys(
2832
label: "open devtools",
2933
// Don't display this hotkey if we're in a VSCode debug session
3034
disabled:
31-
!!process.env.VSCODE_INSPECTOR_OPTIONS || args.experimentalTailLogs,
35+
!!process.env.VSCODE_INSPECTOR_OPTIONS ||
36+
(args.remote && args.experimentalTailLogs),
3237
handler: async () => {
3338
const { inspectorUrl } = await primaryDevEnv.proxy.ready.promise;
3439

packages/wrangler/src/pages/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ export const pagesDevCommand = createCommand({
951951
siteInclude: undefined,
952952
siteExclude: undefined,
953953
enableContainers: false,
954-
experimentalTailLogs: false,
954+
experimentalTailLogs: true,
955955
})
956956
);
957957

0 commit comments

Comments
 (0)