diff --git a/core/src/index.ts b/core/src/index.ts index 2837c6613a6..b77dff73592 100644 --- a/core/src/index.ts +++ b/core/src/index.ts @@ -8,7 +8,7 @@ export { getTimeGivenProgression } from './utils/animation/cubic-bezier'; export { createGesture } from './utils/gesture'; export { initialize } from './global/ionic-global'; export { componentOnReady } from './utils/helpers'; -export { LogLevel } from './utils/logging'; +export { LogLevel, printIonWarning, printIonError } from './utils/logging'; export { isPlatform, Platforms, PlatformConfig, getPlatforms } from './utils/platform'; export { IonicSafeString } from './utils/sanitization'; export { IonicConfig, getMode, setupConfig } from './utils/config'; diff --git a/core/src/utils/logging/index.ts b/core/src/utils/logging/index.ts index 48158d13bcb..99a55424770 100644 --- a/core/src/utils/logging/index.ts +++ b/core/src/utils/logging/index.ts @@ -34,6 +34,8 @@ const isLogLevelEnabled = (minimum: LogLevel): boolean => { * to indicate the library that is warning the developer. * * @param message - The string message to be logged to the console. + * + * @internal */ export const printIonWarning = (message: string, ...params: any[]) => { if (isLogLevelEnabled(LogLevel.WARN)) { @@ -47,6 +49,8 @@ export const printIonWarning = (message: string, ...params: any[]) => { * * @param message - The string message to be logged to the console. * @param params - Additional arguments to supply to the console.error. + * + * @internal */ export const printIonError = (message: string, ...params: any[]) => { if (isLogLevelEnabled(LogLevel.ERROR)) { diff --git a/packages/vue/src/components/IonRouterOutlet.ts b/packages/vue/src/components/IonRouterOutlet.ts index c1dd12fe48e..2a53b8d153b 100644 --- a/packages/vue/src/components/IonRouterOutlet.ts +++ b/packages/vue/src/components/IonRouterOutlet.ts @@ -1,5 +1,6 @@ import type { AnimationBuilder } from "@ionic/core/components"; import { + printIonWarning, LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, @@ -292,7 +293,7 @@ export const IonRouterOutlet = /*@__PURE__*/ defineComponent({ * methods to work properly. */ if (enteringEl === undefined) { - console.warn(`[@ionic/vue Warning]: The view you are trying to render for path ${routeInfo.pathname} does not have the required component. Transitions and lifecycle methods may not work as expected. + printIonWarning(`The view you are trying to render for path ${routeInfo.pathname} does not have the required component. Transitions and lifecycle methods may not work as expected. See https://ionicframework.com/docs/vue/navigation#ionpage for more information.`); } diff --git a/packages/vue/src/hooks/lifecycle.ts b/packages/vue/src/hooks/lifecycle.ts index 5ab3d2c850e..0ddac52a5a4 100644 --- a/packages/vue/src/hooks/lifecycle.ts +++ b/packages/vue/src/hooks/lifecycle.ts @@ -1,3 +1,4 @@ +import { printIonWarning } from "@ionic/core/components"; import type { ComponentInternalInstance } from "vue"; import { getCurrentInstance } from "vue"; @@ -35,8 +36,8 @@ const injectHook = ( return wrappedHook; } else { - console.warn( - "[@ionic/vue]: Ionic Lifecycle Hooks can only be used during execution of setup()." + printIonWarning( + "Ionic Lifecycle Hooks can only be used during execution of setup()." ); } };