mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 07:41:51 +08:00
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:
@ -63,7 +63,7 @@ export class DatetimeButton implements ComponentInterface {
|
||||
const { datetime } = this;
|
||||
if (!datetime) {
|
||||
printIonError(
|
||||
'An ID associated with an ion-datetime instance is required for ion-datetime-button to function properly.',
|
||||
'[ion-datetime-button] - An ID associated with an ion-datetime instance is required to function properly.',
|
||||
this.el
|
||||
);
|
||||
return;
|
||||
@ -71,7 +71,7 @@ export class DatetimeButton implements ComponentInterface {
|
||||
|
||||
const datetimeEl = (this.datetimeEl = document.getElementById(datetime) as HTMLIonDatetimeElement | null);
|
||||
if (!datetimeEl) {
|
||||
printIonError(`No ion-datetime instance found for ID '${datetime}'.`, this.el);
|
||||
printIonError(`[ion-datetime-button] - No ion-datetime instance found for ID '${datetime}'.`, this.el);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ export class DatetimeButton implements ComponentInterface {
|
||||
*/
|
||||
if (datetimeEl.tagName !== 'ION-DATETIME') {
|
||||
printIonError(
|
||||
`Expected an ion-datetime instance for ID '${datetime}' but received '${datetimeEl.tagName.toLowerCase()}' instead.`,
|
||||
`[ion-datetime-button] - Expected an ion-datetime instance for ID '${datetime}' but received '${datetimeEl.tagName.toLowerCase()}' instead.`,
|
||||
datetimeEl
|
||||
);
|
||||
return;
|
||||
@ -245,7 +245,7 @@ export class DatetimeButton implements ComponentInterface {
|
||||
try {
|
||||
headerText = titleSelectedDatesFormatter(parsedValues);
|
||||
} catch (e) {
|
||||
printIonError('Exception in provided `titleSelectedDatesFormatter`: ', e);
|
||||
printIonError('[ion-datetime-button] - Exception in provided `titleSelectedDatesFormatter`:', e);
|
||||
}
|
||||
}
|
||||
this.dateText = headerText;
|
||||
|
||||
Reference in New Issue
Block a user