fix(config): allow LogLevel to work with isolatedModules and update all warns and errors to respect logLevel (#30350)

Issue number: internal

---------

## What is the current behavior?
- `LogLevel` throws error `Error: Cannot access ambient const enums when
'isolatedModules' is enabled`
- Several existing console warns and errors are not calling the function
that respects the `logLevel` config

## What is the new behavior?
- Remove `const` from the `enum` to work with `isolatedModules`
- Update `console.warn`s to `printIonWarning`
- Update `console.error`s to `printIonError`

## Does this introduce a breaking change?
- [ ] Yes
- [x] No

## Other information

Dev build: `8.5.5-dev.11744729748.174bf7e0`

---------

Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
This commit is contained in:
Brandy Smith
2025-04-16 12:23:16 -04:00
committed by GitHub
parent 8dd566b5c1
commit d52fca084c
41 changed files with 124 additions and 92 deletions

View File

@ -97,7 +97,7 @@ export class Nav implements NavOutlet {
this.setRoot(this.root, this.rootParams);
}
} else if (isDev) {
printIonWarning('<ion-nav> does not support a root attribute when using ion-router.', this.el);
printIonWarning('[ion-nav] - A root attribute is not supported when using ion-router.', this.el);
}
}
@ -820,8 +820,8 @@ export class Nav implements NavOutlet {
const finalNumViews = this.views.length + (insertViews?.length ?? 0) - (removeCount ?? 0);
assert(finalNumViews >= 0, 'final balance can not be negative');
if (finalNumViews === 0) {
console.warn(
`You can't remove all the pages in the navigation stack. nav.pop() is probably called too many times.`,
printIonWarning(
`[ion-nav] - You can't remove all the pages in the navigation stack. nav.pop() is probably called too many times.`,
this,
this.el
);