From cbae18368ed2f9f92513331db8e57bd0f84cd2d1 Mon Sep 17 00:00:00 2001 From: OS-jacobbell <228905018+OS-jacobbell@users.noreply.github.com> Date: Tue, 15 Sep 2026 15:13:09 -0600 Subject: [PATCH 1/6] chore(vue): respect config log level --- core/src/index.ts | 2 +- packages/vue/src/components/IonRouterOutlet.ts | 3 ++- packages/vue/src/hooks/lifecycle.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) 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/packages/vue/src/components/IonRouterOutlet.ts b/packages/vue/src/components/IonRouterOutlet.ts index c1dd12fe48e..a86203437b8 100644 --- a/packages/vue/src/components/IonRouterOutlet.ts +++ b/packages/vue/src/components/IonRouterOutlet.ts @@ -1,3 +1,4 @@ +import { printIonWarning } from "@ionic/core"; import type { AnimationBuilder } from "@ionic/core/components"; import { LIFECYCLE_DID_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(`[@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. 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..4806bcc1418 100644 --- a/packages/vue/src/hooks/lifecycle.ts +++ b/packages/vue/src/hooks/lifecycle.ts @@ -1,3 +1,4 @@ +import { printIonWarning } from "@ionic/core"; import type { ComponentInternalInstance } from "vue"; import { getCurrentInstance } from "vue"; @@ -35,7 +36,7 @@ const injectHook = ( return wrappedHook; } else { - console.warn( + printIonWarning( "[@ionic/vue]: Ionic Lifecycle Hooks can only be used during execution of setup()." ); } From 5c3b852213105f28824779e9753a63309d61d8ac Mon Sep 17 00:00:00 2001 From: OS-jacobbell <228905018+OS-jacobbell@users.noreply.github.com> Date: Wed, 16 Sep 2026 11:19:49 -0600 Subject: [PATCH 2/6] get the global config --- core/src/utils/logging/index.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/core/src/utils/logging/index.ts b/core/src/utils/logging/index.ts index 48158d13bcb..ceec53585e7 100644 --- a/core/src/utils/logging/index.ts +++ b/core/src/utils/logging/index.ts @@ -1,4 +1,4 @@ -import { config } from '@global/config'; +import { Config } from '@global/config'; export enum LogLevel { OFF = 'OFF', @@ -20,13 +20,23 @@ const LOG_LEVEL_RANK: Record = { [LogLevel.DEBUG]: 3, }; +const getConfigLogLevel = (): LogLevel => { + if (typeof (window as any) !== 'undefined') { + const Ionic = (window as any).Ionic; + if (Ionic && Ionic.config) { + const config = Ionic.config as Config; + // Levels set through a query parameter arrive as raw strings, hence the uppercasing. + return String(config.get('logLevel', LogLevel.WARN)).toUpperCase() as LogLevel; + } + } + return LogLevel.WARN; +}; + /** - * Whether the configured level is verbose enough to log `minimum`. Levels set - * through a query parameter arrive as raw strings, hence the uppercasing. + * Whether the configured level is verbose enough to log `minimum`. */ const isLogLevelEnabled = (minimum: LogLevel): boolean => { - const configured = String(config.get('logLevel', LogLevel.WARN)).toUpperCase() as LogLevel; - return LOG_LEVEL_RANK[configured] >= LOG_LEVEL_RANK[minimum]; + return LOG_LEVEL_RANK[getConfigLogLevel()] >= LOG_LEVEL_RANK[minimum]; }; /** From cbf14e01ad16df67481647224451140283833a24 Mon Sep 17 00:00:00 2001 From: OS-jacobbell <228905018+OS-jacobbell@users.noreply.github.com> Date: Wed, 16 Sep 2026 14:22:32 -0600 Subject: [PATCH 3/6] import `printIonWarning` from `@ionic/core/components` --- core/src/utils/logging/index.ts | 20 +++++-------------- .../vue/src/components/IonRouterOutlet.ts | 3 ++- packages/vue/src/hooks/lifecycle.ts | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/core/src/utils/logging/index.ts b/core/src/utils/logging/index.ts index ceec53585e7..48158d13bcb 100644 --- a/core/src/utils/logging/index.ts +++ b/core/src/utils/logging/index.ts @@ -1,4 +1,4 @@ -import { Config } from '@global/config'; +import { config } from '@global/config'; export enum LogLevel { OFF = 'OFF', @@ -20,23 +20,13 @@ const LOG_LEVEL_RANK: Record = { [LogLevel.DEBUG]: 3, }; -const getConfigLogLevel = (): LogLevel => { - if (typeof (window as any) !== 'undefined') { - const Ionic = (window as any).Ionic; - if (Ionic && Ionic.config) { - const config = Ionic.config as Config; - // Levels set through a query parameter arrive as raw strings, hence the uppercasing. - return String(config.get('logLevel', LogLevel.WARN)).toUpperCase() as LogLevel; - } - } - return LogLevel.WARN; -}; - /** - * Whether the configured level is verbose enough to log `minimum`. + * Whether the configured level is verbose enough to log `minimum`. Levels set + * through a query parameter arrive as raw strings, hence the uppercasing. */ const isLogLevelEnabled = (minimum: LogLevel): boolean => { - return LOG_LEVEL_RANK[getConfigLogLevel()] >= LOG_LEVEL_RANK[minimum]; + const configured = String(config.get('logLevel', LogLevel.WARN)).toUpperCase() as LogLevel; + return LOG_LEVEL_RANK[configured] >= LOG_LEVEL_RANK[minimum]; }; /** diff --git a/packages/vue/src/components/IonRouterOutlet.ts b/packages/vue/src/components/IonRouterOutlet.ts index a86203437b8..682885327c6 100644 --- a/packages/vue/src/components/IonRouterOutlet.ts +++ b/packages/vue/src/components/IonRouterOutlet.ts @@ -1,6 +1,6 @@ -import { printIonWarning } from "@ionic/core"; import type { AnimationBuilder } from "@ionic/core/components"; import { + printIonWarning, LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, @@ -43,6 +43,7 @@ export const IonRouterOutlet = /*@__PURE__*/ defineComponent({ }, setup() { defineCustomElement(); + printIonWarning("Warning: it's visible!"); const injectedRoute = inject(routeLocationKey)!; const route = useRoute(); diff --git a/packages/vue/src/hooks/lifecycle.ts b/packages/vue/src/hooks/lifecycle.ts index 4806bcc1418..41602788503 100644 --- a/packages/vue/src/hooks/lifecycle.ts +++ b/packages/vue/src/hooks/lifecycle.ts @@ -1,4 +1,4 @@ -import { printIonWarning } from "@ionic/core"; +import { printIonWarning } from "@ionic/core/components"; import type { ComponentInternalInstance } from "vue"; import { getCurrentInstance } from "vue"; From 3b42e9fbf26921f598be35efb243a0e89b9edd26 Mon Sep 17 00:00:00 2001 From: OS-jacobbell <228905018+OS-jacobbell@users.noreply.github.com> Date: Wed, 16 Sep 2026 14:25:29 -0600 Subject: [PATCH 4/6] clean up test warning --- packages/vue/src/components/IonRouterOutlet.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/vue/src/components/IonRouterOutlet.ts b/packages/vue/src/components/IonRouterOutlet.ts index 682885327c6..1b919837179 100644 --- a/packages/vue/src/components/IonRouterOutlet.ts +++ b/packages/vue/src/components/IonRouterOutlet.ts @@ -43,7 +43,6 @@ export const IonRouterOutlet = /*@__PURE__*/ defineComponent({ }, setup() { defineCustomElement(); - printIonWarning("Warning: it's visible!"); const injectedRoute = inject(routeLocationKey)!; const route = useRoute(); From ce875ed191b4f7f375e037e27a16ee5e02ba9700 Mon Sep 17 00:00:00 2001 From: OS-jacobbell <228905018+OS-jacobbell@users.noreply.github.com> Date: Wed, 16 Sep 2026 14:51:44 -0600 Subject: [PATCH 5/6] mark print functions as internal --- core/src/utils/logging/index.ts | 4 ++++ packages/vue/src/components/IonRouterOutlet.ts | 2 +- packages/vue/src/hooks/lifecycle.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/utils/logging/index.ts b/core/src/utils/logging/index.ts index 48158d13bcb..c4640ac6ca5 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 1b919837179..2a53b8d153b 100644 --- a/packages/vue/src/components/IonRouterOutlet.ts +++ b/packages/vue/src/components/IonRouterOutlet.ts @@ -293,7 +293,7 @@ export const IonRouterOutlet = /*@__PURE__*/ defineComponent({ * methods to work properly. */ if (enteringEl === undefined) { - printIonWarning(`[@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 41602788503..0ddac52a5a4 100644 --- a/packages/vue/src/hooks/lifecycle.ts +++ b/packages/vue/src/hooks/lifecycle.ts @@ -37,7 +37,7 @@ const injectHook = ( return wrappedHook; } else { printIonWarning( - "[@ionic/vue]: Ionic Lifecycle Hooks can only be used during execution of setup()." + "Ionic Lifecycle Hooks can only be used during execution of setup()." ); } }; From 82374c4bc7f6602ecdfd3ce1b5da0dec5abd05d0 Mon Sep 17 00:00:00 2001 From: OS-jacobbell <228905018+OS-jacobbell@users.noreply.github.com> Date: Thu, 17 Sep 2026 08:04:15 -0600 Subject: [PATCH 6/6] lint --- core/src/utils/logging/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/utils/logging/index.ts b/core/src/utils/logging/index.ts index c4640ac6ca5..99a55424770 100644 --- a/core/src/utils/logging/index.ts +++ b/core/src/utils/logging/index.ts @@ -34,7 +34,7 @@ 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[]) => { @@ -49,7 +49,7 @@ 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[]) => {