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..effb07c0eb6 100644 --- a/packages/wrangler/src/dev/miniflare/stdio.ts +++ b/packages/wrangler/src/dev/miniflare/stdio.ts @@ -185,7 +185,11 @@ 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) + return logger.info(message); } if (level === "error") {