UNPKG

react-native-firebase-compiled

Version:

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

56 lines (42 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initialiseLogger = exports.LEVELS = exports.getLogger = void 0; var _internals = _interopRequireDefault(require("./internals")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const NATIVE_LOGGERS = {}; const getModuleKey = module => `${module.app.name}:${module.namespace}`; const getLogger = module => { const key = getModuleKey(module); return NATIVE_LOGGERS[key]; }; exports.getLogger = getLogger; const LEVELS = { debug: 0, info: 1, warn: 2, error: 3 }; exports.LEVELS = LEVELS; const initialiseLogger = (module, logNamespace) => { const key = getModuleKey(module); if (!NATIVE_LOGGERS[key]) { const prefix = `🔥 ${logNamespace.toUpperCase()}`; NATIVE_LOGGERS[key] = { debug(...args) { if (__DEV__ && LEVELS.debug >= LEVELS[_internals.default.OPTIONS.logLevel]) console.log(...[prefix, ...args]); }, info(...args) { if (__DEV__ && LEVELS.info >= LEVELS[_internals.default.OPTIONS.logLevel]) console.log(...[prefix, ...args]); }, warn(...args) { if (__DEV__ && LEVELS.warn >= LEVELS[_internals.default.OPTIONS.logLevel]) console.warn(...args); }, error(...args) { console.error(...args); } }; } }; exports.initialiseLogger = initialiseLogger;