format import { isTest } from '../utils/isTest' ; export type LoggerTypes = 'error' | 'warn' | 'info' | 'debug' ; export type LoggerTrackType = 'duration' | 'usage' | 'performance' | 'success-rate' | 'operation-cancelled' ; export type LoggerArgs = { isTest ? : boolean ; } ; export interface Logger { track ( type , event , data ? , plugin ? ) : void ; trackTimeSince ( mark , eventName ? , data ? ) : void ; info ( ... args ) : void ; warn ( ... args ) : void ; error ( ... args ) : void ; debug ( ... args ) : void ; } let instance = null ; export function getLogger ( ) { if ( instance ) { return instance ; } if ( isTest ( ) ) { instance = new NoopLogger ( ) ; return instance ; } throw new Error ( 'Requested Logger instance without initializing it. Make sure init() is called at app start' ) ; } export function setLoggerInstance ( logger ) { instance = logger ; } /**
 * A logger that doesn't log anything, used in tests and public Flipper builds
 */ export class NoopLogger implements Logger { constructor ( ) { } track ( _type , _event , _data ? , _plugin ? ) { } trackTimeSince ( _mark , _eventName ? ) { } info ( _data , _category ) { } warn ( _data , _category ) { } error ( _data , _category ) { } debug ( _data , _category ) { } }