import { consoleSandbox , getGlobalObject } from './misc' ; const global = getGlobalObject < Window > ( ) ; /** Prefix for logging strings */ const PREFIX = 'Beidou Logger ' ; /** JSDoc */ class Logger { /** JSDoc */ private _enabled : boolean ; /** JSDoc */ public constructor ( ) { this . _enabled = false ; } /** JSDoc */ public disable ( ) { this . _enabled = false ; } /** JSDoc */ public enable ( ) { this . _enabled = true ; } /** JSDoc */ public log ( ... args ) { if ( ! this . _enabled ) { return ; } consoleSandbox ( ( ) => { global . console . log ( `${ PREFIX }[Log]: ${ args . join ( ' ' ) }` ) ; } ) ; } /** JSDoc */ public warn ( ... args ) { if ( ! this . _enabled ) { return ; } consoleSandbox ( ( ) => { global . console . warn ( `${ PREFIX }[Warn]: ${ args . join ( ' ' ) }` ) ; } ) ; } /** JSDoc */ public error ( ... args ) { if ( ! this . _enabled ) { return ; } consoleSandbox ( ( ) => { global . console . error ( `${ PREFIX }[Error]: ${ args . join ( ' ' ) }` ) ; } ) ; } } global . __BEIDOU__ = global . __BEIDOU__ || { } ; const logger = ( global . __BEIDOU__ . logger as Logger ) || ( global . __BEIDOU__ . logger = new Logger ( ) ) ; export { logger } ;