import mapState from 'src/components/map-utils/map-state' ; export const debugLog = ( ... args ) => { let text = '' ; args . forEach ( arg => { text = `${ Date ( ) . toLocaleLowerCase ( ) . substring ( 16 , 24 ) } ms: ${ new Date ( ) . getMilliseconds ( ) } ` ; const isPrimitive = [ 'string' , 'number' , 'boolean' , 'undefined' ] . includes ( typeof arg ) ; if ( isPrimitive ) { text += `${ arg } ` ; } else { if ( text ) { console . log ( text , arg ) ; } else { console . log ( arg ) ; } text = '' ; } } ) ; if ( text ) { console . log ( `${ text }` ) ; } } ; export const debugMarkers = ( msg ) => { const { mapInfo } = mapState ( ) ; debugLog ( msg ) ; debugLog ( 'clustering size' , mapInfo ?. clustering ?. clusterMarkers . size , 'clusterer total' , mapInfo ?. markerClusterer . getTotalClusters ( ) , 'markers' , 'clusterer getMarkers size' , mapInfo ?. markerClusterer . getMarkers ( ) . length ) ; } ; export const debugLogTimeStart = ( startLabel , ... args ) => { console . time ( startLabel ) ; debugLog ( `Time log: Starting ${ startLabel }` , ... args ) ; } ; export const debugLogTimeEnd = ( endLabel , ... args ) => { console . timeEnd ( endLabel ) ; debugLog ( `Time log: Ending ${ endLabel }` , ... args ) ; } ; export const debugLogTime = ( timeLabel , ... args ) => { console . timeLog ( timeLabel ) ; debugLog ( 'Time log: Logging' , ... args ) ; } ;