Skip to content

fix(many): gate debug logs behind the DEBUG log level - #31342

Merged
ShaneK merged 2 commits into
major-9.0from
FW-7658
Aug 11, 2026
Merged

fix(many): gate debug logs behind the DEBUG log level#31342
ShaneK merged 2 commits into
major-9.0from
FW-7658

Conversation

@ShaneK

@ShaneK ShaneK commented Aug 10, 2026

Copy link
Copy Markdown
Member

Issue number: internal


What is the current behavior?

Currently, StackManager in @ionic/react-router writes six some console logs that most users do not use. They're still useful for debugging issues with routing though if they come up again, so we left them in. However, every user using the stack manger would get these logs regardless of if they're debugging something or not.

What is the new behavior?

The logs now go through a gated logger and stay silent unless the app asks for them with logLevel: 'DEBUG', either through setupIonicReact({ logLevel: LogLevel.DEBUG }) or ?ionic:logLevel=DEBUG in the URL. We reuse Ionic's existing logLevel config rather than adding a second switch, so DEBUG is a new member of the LogLevel enum and printIonWarning / printIonError now compare ranks instead of testing array membership.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Initially I thought all of these logs had some value, but on review I found some of them did not and caused extra overhead for no reason. During this PR, I cleaned up some logs that no longer had actual purpose, but left ones that I think will provide future value

@ShaneK
ShaneK requested a review from a team as a code owner August 10, 2026 20:38
@ShaneK
ShaneK requested a review from gnbm August 10, 2026 20:38
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview Aug 11, 2026 6:32pm

Request Review

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with minor suggestions

Comment thread core/src/utils/logging/index.ts Outdated
Comment thread docs/react-router/README.md Outdated
Comment thread docs/react-router/testing.md Outdated
Comment thread packages/react/src/utils/debug.ts
return;
}

const prefix = `[Ionic Debug]: [${namespace}] - ${event}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this! It's easy to spot that it's coming from Ionic now.

@ShaneK
ShaneK merged commit 810268e into major-9.0 Aug 11, 2026
53 checks passed
@ShaneK
ShaneK deleted the FW-7658 branch August 11, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package package: react @ionic/react package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants