@@ -2,6 +2,7 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core';
22import { Component , Element , Event , Listen , Method , Prop } from '@stencil/core' ;
33import type { BackButtonEvent } from '@utils/hardware-back-button' ;
44import { debounce } from '@utils/helpers' ;
5+ import { printIonError , printIonWarning } from '@utils/logging' ;
56
67import type { AnimationBuilder } from '../../interface' ;
78import type { NavigationHookResult } from '../route/route-interface' ;
@@ -166,14 +167,14 @@ export class Router implements ComponentInterface {
166167 @Method ( )
167168 async navChanged ( direction : RouterDirection ) : Promise < boolean > {
168169 if ( this . busy ) {
169- console . warn ( '[ion-router] router is busy, navChanged was cancelled' ) ;
170+ printIonWarning ( '[ion-router] router is busy, navChanged was cancelled' ) ;
170171 return false ;
171172 }
172173 const { ids, outlet } = await readNavState ( window . document . body ) ;
173174 const routes = readRoutes ( this . el ) ;
174175 const chain = findChainForIDs ( ids , routes ) ;
175176 if ( ! chain ) {
176- console . warn (
177+ printIonWarning (
177178 '[ion-router] no matching URL for ' ,
178179 ids . map ( ( i ) => i . id )
179180 ) ;
@@ -182,7 +183,7 @@ export class Router implements ComponentInterface {
182183
183184 const segments = chainToSegments ( chain ) ;
184185 if ( ! segments ) {
185- console . warn ( '[ion-router] router could not match path because some required param is missing' ) ;
186+ printIonWarning ( '[ion-router] router could not match path because some required param is missing' ) ;
186187 return false ;
187188 }
188189
@@ -232,7 +233,7 @@ export class Router implements ComponentInterface {
232233 animation ?: AnimationBuilder
233234 ) : Promise < boolean > {
234235 if ( ! segments ) {
235- console . error ( '[ion-router] URL is not part of the routing set' ) ;
236+ printIonError ( '[ion-router] URL is not part of the routing set' ) ;
236237 return false ;
237238 }
238239
@@ -253,7 +254,7 @@ export class Router implements ComponentInterface {
253254 const routes = readRoutes ( this . el ) ;
254255 const chain = findChainForSegments ( segments , routes ) ;
255256 if ( ! chain ) {
256- console . error ( '[ion-router] the path does not match any route' ) ;
257+ printIonError ( '[ion-router] the path does not match any route' ) ;
257258 return false ;
258259 }
259260
@@ -275,7 +276,7 @@ export class Router implements ComponentInterface {
275276 try {
276277 changed = await this . writeNavState ( node , chain , direction , segments , redirectFrom , index , animation ) ;
277278 } catch ( e ) {
278- console . error ( e ) ;
279+ printIonError ( '[ion-router]' , e ) ;
279280 }
280281 unlock ( ) ;
281282 return changed ;
@@ -338,7 +339,7 @@ export class Router implements ComponentInterface {
338339 animation ?: AnimationBuilder
339340 ) : Promise < boolean > {
340341 if ( this . busy ) {
341- console . warn ( '[ion-router] router is busy, transition was cancelled' ) ;
342+ printIonWarning ( '[ion-router] router is busy, transition was cancelled' ) ;
342343 return false ;
343344 }
344345 this . busy = true ;
0 commit comments