File size: 598 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import debugFactory from 'debug';

const debug = debugFactory( 'calypso:catch-js-errors:log' );
let logger = null;

/**
 * Save errorLogger Object to be used in log.
 * This is all tied together by `boot/index`. That lets us pull this file easily without importing
 * Everything from ./index on environments that don't support remote error logging or in SSR
 * @param  {Object} loggerObject
 */
export function registerLogger( loggerObject ) {
	logger = loggerObject;
}

export default function log( msg, data ) {
	debug( msg, data );
	if ( logger && logger.log ) {
		logger.log( msg, data );
	}
}