Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mean-parks-take.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix `console.debug` logs not being logged at the `info` level (as users expect)
3 changes: 3 additions & 0 deletions fixtures/worker-logs/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe("'wrangler dev' correctly displays logs", () => {
expect(output).toMatchInlineSnapshot(`
"X [ERROR] <<<<<this is an error>>>>>
▲ [WARNING] <<<<<this is a warning>>>>>
<<<<<this is a debug message>>>>>
<<<<<this is a log>>>>>
<<<<<this is an info message>>>>>"
`);
Expand All @@ -79,6 +80,7 @@ describe("'wrangler dev' correctly displays logs", () => {
expect(output).toMatchInlineSnapshot(`
"X [ERROR] <<<<<this is an error>>>>>
▲ [WARNING] <<<<<this is a warning>>>>>
<<<<<this is a debug message>>>>>
<<<<<this is a log>>>>>
<<<<<this is an info message>>>>>"
`);
Expand All @@ -89,6 +91,7 @@ describe("'wrangler dev' correctly displays logs", () => {
expect(output).toMatchInlineSnapshot(`
"X [ERROR] <<<<<this is an error>>>>>
▲ [WARNING] <<<<<this is a warning>>>>>
<<<<<this is a debug message>>>>>
<<<<<this is an info message>>>>>"
`);
});
Expand Down
6 changes: 5 additions & 1 deletion packages/wrangler/src/dev/miniflare/stdio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
Loading