/**
* Copyright (c) Maksym Rusynyk 2018 - present
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/ const TAG = 'PIXELS_CATCHER::UTIL_LOG' ; const logLevels = { v : 4 , d : 3 , i : 2 , w : 1 , e : 0 , } ; let activeLevel = logLevels . i ; const log = { v ( tag , ... args ) { if ( activeLevel >= logLevels . v ) { global . console . log ( `${ tag }:` , ... args ) ; } } , d : ( tag , ... args ) => { if ( activeLevel >= logLevels . d ) { global . console . log ( `${ tag }:` , ... args ) ; } } , i : ( tag , ... args ) => { if ( activeLevel >= logLevels . i ) { global . console . log ( `${ tag }:` , ... args ) ; } } , w : ( tag , ... args ) => { if ( activeLevel >= logLevels . w ) { global . console . log ( `${ tag } WARNING:` , ... args ) ; } } , e : ( tag , ... args ) => { if ( activeLevel >= logLevels . e ) { global . console . log ( `${ tag } ERROR:` , ... args ) ; } } , setLevel ( level = 'i' ) { let nextLevel = logLevels [ level ] ; if ( nextLevel === undefined ) { global . console . log ( `${ TAG } WARNING:` , `Invalid level [${ level }]. Supported levels: ${ Object . keys ( logLevels ) . join ( ', ' ) }` ) ; nextLevel = logLevels . i ; } activeLevel = nextLevel ; } , } ; export default log ;