From 7ab38319a2b104fded35ea8471f67c4b8747c487 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 25 Sep 2025 11:24:15 +0100 Subject: [PATCH 1/2] Wrangler: fix `console.debug` logs not being logged at the `info` level (as users expect) --- .changeset/mean-parks-take.md | 5 +++++ fixtures/worker-logs/tests/index.test.ts | 3 +++ packages/wrangler/src/dev/miniflare/stdio.ts | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .changeset/mean-parks-take.md diff --git a/.changeset/mean-parks-take.md b/.changeset/mean-parks-take.md new file mode 100644 index 00000000000..e00febfc240 --- /dev/null +++ b/.changeset/mean-parks-take.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +fix `console.debug` logs not being logged at the `info` level (as users expect) diff --git a/fixtures/worker-logs/tests/index.test.ts b/fixtures/worker-logs/tests/index.test.ts index 5779a918482..4a19edde17d 100644 --- a/fixtures/worker-logs/tests/index.test.ts +++ b/fixtures/worker-logs/tests/index.test.ts @@ -69,6 +69,7 @@ describe("'wrangler dev' correctly displays logs", () => { expect(output).toMatchInlineSnapshot(` "X [ERROR] <<<<>>>> ▲ [WARNING] <<<<>>>> + <<<<>>>> <<<<>>>> <<<<>>>>" `); @@ -79,6 +80,7 @@ describe("'wrangler dev' correctly displays logs", () => { expect(output).toMatchInlineSnapshot(` "X [ERROR] <<<<>>>> ▲ [WARNING] <<<<>>>> + <<<<>>>> <<<<>>>> <<<<>>>>" `); @@ -89,6 +91,7 @@ describe("'wrangler dev' correctly displays logs", () => { expect(output).toMatchInlineSnapshot(` "X [ERROR] <<<<>>>> ▲ [WARNING] <<<<>>>> + <<<<>>>> <<<<>>>>" `); }); diff --git a/packages/wrangler/src/dev/miniflare/stdio.ts b/packages/wrangler/src/dev/miniflare/stdio.ts index 3953d4a8e65..9ab74230da3 100644 --- a/packages/wrangler/src/dev/miniflare/stdio.ts +++ b/packages/wrangler/src/dev/miniflare/stdio.ts @@ -185,7 +185,15 @@ function logStructuredLog( } if (level === "debug") { - return logger.debug(message); + // note that debug logs are logged at the info level, this is like so because before structured logs + // were introduced developers were used to call `console.debug` and get their logs in the terminal + // during local development and we don't want to break such workflow in a non-major release + // (For more context see: https://github.com/cloudflare/workers-sdk/issues/10690) + // + // TODO: for the next major release we do want the debug logs to be logged at the debug level instead, + // we should also introduce some mechanism to allows users to get their worker debug logs without + // also getting all the wrangler debug logs + return logger.info(message); } if (level === "error") { From 5fa491a08c7314fda4edf5e698a983f26c1d5513 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 25 Sep 2025 11:48:08 +0100 Subject: [PATCH 2/2] remove TODO comment --- packages/wrangler/src/dev/miniflare/stdio.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/wrangler/src/dev/miniflare/stdio.ts b/packages/wrangler/src/dev/miniflare/stdio.ts index 9ab74230da3..effb07c0eb6 100644 --- a/packages/wrangler/src/dev/miniflare/stdio.ts +++ b/packages/wrangler/src/dev/miniflare/stdio.ts @@ -189,10 +189,6 @@ function logStructuredLog( // were introduced developers were used to call `console.debug` and get their logs in the terminal // during local development and we don't want to break such workflow in a non-major release // (For more context see: https://github.com/cloudflare/workers-sdk/issues/10690) - // - // TODO: for the next major release we do want the debug logs to be logged at the debug level instead, - // we should also introduce some mechanism to allows users to get their worker debug logs without - // also getting all the wrangler debug logs return logger.info(message); }