您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

functions.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // @flow
  2. import _ from 'lodash';
  3. import Logger, { getLogger as _getLogger } from 'jitsi-meet-logger';
  4. import LogTransport from './LogTransport';
  5. /**
  6. * Options for building the logger. We disable the callee info on RN because it's
  7. * almost always empty anyway.
  8. */
  9. const DEFAULT_OPTS = {};
  10. const DEFAULT_RN_OPTS = { disableCallerInfo: true };
  11. /**
  12. * Gets a logger for the given id.
  13. *
  14. * @param {string} id - Name for the logger.
  15. * @returns {Object} - The logger object.
  16. */
  17. export function getLogger(id: string) {
  18. const opts = navigator.product === 'ReactNative' ? DEFAULT_RN_OPTS : DEFAULT_OPTS;
  19. return _getLogger(id, undefined, opts);
  20. }
  21. /**
  22. * Initializes native logging. This operations must be done as early as possible.
  23. */
  24. export const _initLogging = _.once(() => {
  25. if (navigator.product !== 'ReactNative') {
  26. return;
  27. }
  28. // Lazy load it to avoid cycles in early web bootstrap code.
  29. const { default: JitsiMeetJS } = require('../lib-jitsi-meet/_');
  30. Logger.setGlobalOptions(DEFAULT_RN_OPTS);
  31. JitsiMeetJS.setGlobalLogOptions(DEFAULT_RN_OPTS);
  32. Logger.removeGlobalTransport(console);
  33. JitsiMeetJS.removeGlobalLogTransport(console);
  34. Logger.addGlobalTransport(LogTransport);
  35. JitsiMeetJS.addGlobalLogTransport(LogTransport);
  36. });