mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-12 17:58:40 +08:00
[internals][types] Fix a couple of minor issues
This commit is contained in:
@@ -13,13 +13,19 @@ import type ModuleBase from './ModuleBase';
|
||||
|
||||
// clean up time
|
||||
|
||||
const NATIVE_LOGGERS: { [ModuleBase]: Object } = {};
|
||||
const NATIVE_LOGGERS: { [string]: Object } = {};
|
||||
|
||||
export const getLogger = (module: ModuleBase) => NATIVE_LOGGERS[module];
|
||||
const getModuleKey = (module: ModuleBase): string => `${module.app.name}:${module.namespace}`;
|
||||
|
||||
export const getLogger = (module: ModuleBase) => {
|
||||
const key = getModuleKey(module);
|
||||
return NATIVE_LOGGERS[key];
|
||||
};
|
||||
|
||||
export const initialiseLogger = (module: ModuleBase, logNamespace: string) => {
|
||||
if (!NATIVE_LOGGERS[module]) {
|
||||
NATIVE_LOGGERS[module] = require('bows')(`🔥 ${logNamespace.toUpperCase()}`);
|
||||
const key = getModuleKey(module);
|
||||
if (!NATIVE_LOGGERS[key]) {
|
||||
NATIVE_LOGGERS[key] = require('bows')(`🔥 ${logNamespace.toUpperCase()}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user