Skip to content

Commit ce813fb

Browse files
committed
refactor(logs): update logs to include component tag or function name
1 parent 9b73dd9 commit ce813fb

File tree

33 files changed

+71
-71
lines changed

33 files changed

+71
-71
lines changed

core/src/components/accordion-group/accordion-group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class AccordionGroup implements ComponentInterface {
8787
* Custom behavior: ['a', 'b']
8888
*/
8989
printIonWarning(
90-
`ion-accordion-group was passed an array of values, but multiple="false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
90+
`[ion-accordion-group] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
9191
9292
Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
9393
`,

core/src/components/alert/alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
320320
const inputTypes = new Set(inputs.map((i) => i.type));
321321
if (inputTypes.has('checkbox') && inputTypes.has('radio')) {
322322
printIonWarning(
323-
`Alert cannot mix input types: ${Array.from(inputTypes.values()).join(
323+
`[ion-alert] - Alert cannot mix input types: ${Array.from(inputTypes.values()).join(
324324
'/'
325325
)}. Please see alert docs for more info.`
326326
);

core/src/components/app/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class App implements ComponentInterface {
4646
*/
4747
if (shouldUseCloseWatcher()) {
4848
printIonWarning(
49-
'experimentalCloseWatcher was set to `true`, but hardwareBackButton was set to `false`. Both config options must be `true` for the Close Watcher API to be used.'
49+
'[ion-app] - experimentalCloseWatcher was set to `true`, but hardwareBackButton was set to `false`. Both config options must be `true` for the Close Watcher API to be used.'
5050
);
5151
}
5252

core/src/components/button/button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
235235
* element with that id is not a form element.
236236
*/
237237
printIonWarning(
238-
`Form with selector: "#${form}" could not be found. Verify that the id is attached to a <form> element.`,
238+
`[ion-button] - Form with selector: "#${form}" could not be found. Verify that the id is attached to a <form> element.`,
239239
this.el
240240
);
241241
return null;
@@ -246,7 +246,7 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
246246
* element with that id could not be found in the DOM.
247247
*/
248248
printIonWarning(
249-
`Form with selector: "#${form}" could not be found. Verify that the id is correct and the form is rendered in the DOM.`,
249+
`[ion-button] - Form with selector: "#${form}" could not be found. Verify that the id is correct and the form is rendered in the DOM.`,
250250
this.el
251251
);
252252
return null;
@@ -260,7 +260,7 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
260260
* as the form attribute.
261261
*/
262262
printIonWarning(
263-
`The provided "form" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`,
263+
`[ion-button] - The provided "form" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`,
264264
this.el
265265
);
266266
return null;

core/src/components/datetime-button/datetime-button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export class DatetimeButton implements ComponentInterface {
6363
const { datetime } = this;
6464
if (!datetime) {
6565
printIonError(
66-
'An ID associated with an ion-datetime instance is required for ion-datetime-button to function properly.',
66+
'[ion-datetime-button] - An ID associated with an ion-datetime instance is required to function properly.',
6767
this.el
6868
);
6969
return;
7070
}
7171

7272
const datetimeEl = (this.datetimeEl = document.getElementById(datetime) as HTMLIonDatetimeElement | null);
7373
if (!datetimeEl) {
74-
printIonError(`No ion-datetime instance found for ID '${datetime}'.`, this.el);
74+
printIonError(`[ion-datetime-button] - No ion-datetime instance found for ID '${datetime}'.`, this.el);
7575
return;
7676
}
7777

@@ -81,7 +81,7 @@ export class DatetimeButton implements ComponentInterface {
8181
*/
8282
if (datetimeEl.tagName !== 'ION-DATETIME') {
8383
printIonError(
84-
`Expected an ion-datetime instance for ID '${datetime}' but received '${datetimeEl.tagName.toLowerCase()}' instead.`,
84+
`[ion-datetime-button] - Expected an ion-datetime instance for ID '${datetime}' but received '${datetimeEl.tagName.toLowerCase()}' instead.`,
8585
datetimeEl
8686
);
8787
return;
@@ -245,7 +245,7 @@ export class DatetimeButton implements ComponentInterface {
245245
try {
246246
headerText = titleSelectedDatesFormatter(parsedValues);
247247
} catch (e) {
248-
printIonError('Exception in provided `titleSelectedDatesFormatter`: ', e);
248+
printIonError('[ion-datetime-button] - Exception in provided `titleSelectedDatesFormatter`:', e);
249249
}
250250
}
251251
this.dateText = headerText;

core/src/components/datetime/datetime.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ export class Datetime implements ComponentInterface {
584584
* Custom behavior: ['a', 'b']
585585
*/
586586
printIonWarning(
587-
`ion-datetime was passed an array of values, but multiple="false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
587+
`[ion-datetime] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
588588
589589
Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
590590
`,
@@ -1389,24 +1389,24 @@ export class Datetime implements ComponentInterface {
13891389

13901390
if (multiple) {
13911391
if (presentation !== 'date') {
1392-
printIonWarning('Multiple date selection is only supported for presentation="date".', el);
1392+
printIonWarning('[ion-datetime] - Multiple date selection is only supported for presentation="date".', el);
13931393
}
13941394

13951395
if (preferWheel) {
1396-
printIonWarning('Multiple date selection is not supported with preferWheel="true".', el);
1396+
printIonWarning('[ion-datetime] - Multiple date selection is not supported with preferWheel="true".', el);
13971397
}
13981398
}
13991399

14001400
if (highlightedDates !== undefined) {
14011401
if (presentation !== 'date' && presentation !== 'date-time' && presentation !== 'time-date') {
14021402
printIonWarning(
1403-
'The highlightedDates property is only supported with the date, date-time, and time-date presentations.',
1403+
'[ion-datetime] - The highlightedDates property is only supported with the date, date-time, and time-date presentations.',
14041404
el
14051405
);
14061406
}
14071407

14081408
if (preferWheel) {
1409-
printIonWarning('The highlightedDates property is not supported with preferWheel="true".', el);
1409+
printIonWarning('[ion-datetime] - The highlightedDates property is not supported with preferWheel="true".', el);
14101410
}
14111411
}
14121412

@@ -1668,7 +1668,7 @@ export class Datetime implements ComponentInterface {
16681668
disabled = !isDateEnabled(convertDataToISO(referenceParts));
16691669
} catch (e) {
16701670
printIonError(
1671-
'Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
1671+
'[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
16721672
e
16731673
);
16741674
}
@@ -1759,7 +1759,7 @@ export class Datetime implements ComponentInterface {
17591759
disabled = !isDateEnabled(convertDataToISO(referenceParts));
17601760
} catch (e) {
17611761
printIonError(
1762-
'Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
1762+
'[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
17631763
e
17641764
);
17651765
}
@@ -2262,7 +2262,7 @@ export class Datetime implements ComponentInterface {
22622262
isCalDayDisabled = !isDateEnabled(dateIsoString);
22632263
} catch (e) {
22642264
printIonError(
2265-
'Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
2265+
'[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
22662266
el,
22672267
e
22682268
);
@@ -2483,7 +2483,7 @@ export class Datetime implements ComponentInterface {
24832483
try {
24842484
headerText = titleSelectedDatesFormatter(convertDataToISO(activeParts));
24852485
} catch (e) {
2486-
printIonError('Exception in provided `titleSelectedDatesFormatter`: ', e);
2486+
printIonError('[ion-datetime] - Exception in provided `titleSelectedDatesFormatter`:', e);
24872487
}
24882488
}
24892489
} else {

core/src/components/datetime/utils/comparison.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const warnIfValueOutOfBounds = (
4848
for (const val of valueArray) {
4949
if ((min !== undefined && isBefore(val, min)) || (max !== undefined && isAfter(val, max))) {
5050
printIonWarning(
51-
'The value provided to ion-datetime is out of bounds.\n\n' +
51+
'[ion-datetime] - The value provided to ion-datetime is out of bounds.\n\n' +
5252
`Min: ${JSON.stringify(min)}\n` +
5353
`Max: ${JSON.stringify(max)}\n` +
5454
`Value: ${JSON.stringify(value)}`

core/src/components/datetime/utils/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function parseDate(val: string | string[] | undefined | null): DatetimePa
105105

106106
if (parse === null) {
107107
// wasn't able to parse the ISO datetime
108-
printIonWarning(`Unable to parse date string: ${val}. Please provide a valid ISO 8601 datetime string.`);
108+
printIonWarning(`[ion-datetime] - Unable to parse date string: ${val}. Please provide a valid ISO 8601 datetime string.`);
109109
return undefined;
110110
}
111111

core/src/components/datetime/utils/state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export const getHighlightStyles = (
218218
return highlightedDates(dateIsoString);
219219
} catch (e) {
220220
printIonError(
221-
'Exception thrown from provided `highlightedDates` callback. Please check your function and try again.',
221+
'[ion-datetime] - Exception thrown from provided `highlightedDates` callback. Please check your function and try again.',
222222
el,
223223
e
224224
);

core/src/components/datetime/utils/validate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const warnIfTimeZoneProvided = (el: HTMLElement, formatOptions?: FormatOp
1414
formatOptions?.time?.timeZone ||
1515
formatOptions?.time?.timeZoneName
1616
) {
17-
printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".', el);
17+
printIonWarning('[ion-datetime] - "timeZone" and "timeZoneName" are not supported in "formatOptions".', el);
1818
}
1919
};
2020

@@ -33,19 +33,19 @@ export const checkForPresentationFormatMismatch = (
3333
case 'month':
3434
case 'year':
3535
if (formatOptions.date === undefined) {
36-
printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`, el);
36+
printIonWarning(`[ion-datetime] - The '${presentation}' presentation requires a date object in formatOptions.`, el);
3737
}
3838
break;
3939
case 'time':
4040
if (formatOptions.time === undefined) {
41-
printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`, el);
41+
printIonWarning(`[ion-datetime] - The 'time' presentation requires a time object in formatOptions.`, el);
4242
}
4343
break;
4444
case 'date-time':
4545
case 'time-date':
4646
if (formatOptions.date === undefined && formatOptions.time === undefined) {
4747
printIonWarning(
48-
`Datetime: The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`,
48+
`[ion-datetime] - The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`,
4949
el
5050
);
5151
}

0 commit comments

Comments
 (0)