Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): add logLevel option to suppress ionic warnings and errors #30015

Merged
merged 9 commits into from
Jan 20, 2025

Conversation

sean-perkins
Copy link
Contributor

Issue number: resolves #29814


What is the current behavior?

Developers may receive Ionic warnings and errors in their console, logs and CI runs (for tests). Currently there is not a mechanism for developers to opt-out of these logs in situations where they are intentionally configuring Ionic in a way to produce a warning.

What is the new behavior?

  • Developers can assign a value to logLevel in the Ionic config to control the log level that Ionic will produce logs for.
    • OFF will completely disable all warnings and errors from Ionic
    • WARN will log warnings and errors
    • ERROR will log only errors
  • Default behavior is that developers receive both Ionic warnings and errors
  • Configuration only applies to usages of printIonWarning and printIonError

Does this introduce a breaking change?

  • Yes
  • No

Other information

This feature, if accepted, should be targeted to a minor release.

Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 20, 2025 9:02pm

@github-actions github-actions bot added the package: core @ionic/core package label Nov 13, 2024
@sean-perkins sean-perkins marked this pull request as ready for review November 13, 2024 19:12
@sean-perkins sean-perkins requested a review from a team as a code owner November 13, 2024 19:12
@brandyscarney
Copy link
Member

Can we put this against a feature branch?

@brandyscarney brandyscarney changed the base branch from main to feature-8.5 January 17, 2025 15:52
Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Overall LGTM 👍

Nit:
I would maybe create an enum for log levels, e.g.:

const enum LogLevel {
    INFO = 'INFO',
    ERROR = 'ERROR',
    WARN = 'WARN'
}

So renaming the log levels or enhancing them will be easier.

Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM

@brandyscarney brandyscarney changed the title feat(core): developers can suppress ionic warnings and errors feat(config): add logLevel option to suppress ionic warnings and errors Jan 20, 2025
Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM

@brandyscarney brandyscarney merged commit efd3e0f into feature-8.5 Jan 20, 2025
47 checks passed
@brandyscarney brandyscarney deleted the sp/log-level branch January 20, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Add option to IonicConfig to disable Ionic warning and error logs
5 participants