Saúl Ibarra Corretgé 5a934c071a logging: use individual, names loggers
React Native doesn't define __filename nor __dirname so do it artisanally. In
addition, this helps with centralizing the configuration passed to loggers.
2019-08-23 10:57:38 +02:00

23 lines
579 B
JavaScript

// @flow
import { getLogger as _getLogger } from 'jitsi-meet-logger';
/**
* Options for building the logger. We disable the callee info on RN because it's
* almost always empty anyway.
*/
const DEFAULT_OPTS = {};
const DEFAULT_RN_OPTS = { disableCallerInfo: true };
/**
* Gets a logger for the given id.
*
* @param {string} id - Name for the logger.
* @returns {Object} - The logger object.
*/
export function getLogger(id: string) {
const opts = navigator.product === 'ReactNative' ? DEFAULT_RN_OPTS : DEFAULT_OPTS;
return _getLogger(id, undefined, opts);
}