Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!apiKey) {
throw ERROR_FACTORY.create(ErrorCode.REGISTRATION_API_KEY);
}
if (!appId) {
throw ERROR_FACTORY.create(ErrorCode.REGISTRATION_APP_ID);
}
namespace = namespace || 'firebase';
const storage = new Storage(appId, app.name, namespace);
const storageCache = new StorageCache(storage);
const logger = new Logger(packageName);
// Sets ERROR as the default log level.
// See RemoteConfig#setLogLevel for corresponding normalization to ERROR log level.
logger.logLevel = FirebaseLogLevel.ERROR;
const restClient = new RestClient(
installations,
// Uses the JS SDK version, by which the RC package version can be deduced, if necessary.
firebaseInstance.SDK_VERSION,
namespace,
projectId,
apiKey,
appId
);
const retryingClient = new RetryingClient(restClient, storage);
const cachingClient = new CachingClient(
retryingClient,
storage,
storageCache,
logger
setLogLevel(logLevel: RemoteConfigLogLevel): void {
switch (logLevel) {
case 'debug':
this._logger.logLevel = FirebaseLogLevel.DEBUG;
break;
case 'silent':
this._logger.logLevel = FirebaseLogLevel.SILENT;
break;
default:
this._logger.logLevel = FirebaseLogLevel.ERROR;
}
}
setLogLevel(logLevel) {
switch (logLevel) {
case 'debug':
this._logger.logLevel = LogLevel.DEBUG;
break;
case 'silent':
this._logger.logLevel = LogLevel.SILENT;
break;
default:
this._logger.logLevel = LogLevel.ERROR;
}
}
get fetchTimeMillis() {
RemoteConfig.prototype.setLogLevel = function (logLevel) {
switch (logLevel) {
case 'debug':
this._logger.logLevel = LogLevel.DEBUG;
break;
case 'silent':
this._logger.logLevel = LogLevel.SILENT;
break;
default:
this._logger.logLevel = LogLevel.ERROR;
}
};
Object.defineProperty(RemoteConfig.prototype, "fetchTimeMillis", {
export function setLogLevel(newLevel: LogLevel): void {
/**
* Map the new log level to the associated Firebase Log Level
*/
switch (newLevel) {
case LogLevel.DEBUG:
logClient.logLevel = FirebaseLogLevel.DEBUG;
break;
case LogLevel.ERROR:
logClient.logLevel = FirebaseLogLevel.ERROR;
break;
case LogLevel.SILENT:
logClient.logLevel = FirebaseLogLevel.SILENT;
break;
default:
logClient.error(
`Firestore (${SDK_VERSION}): Invalid value passed to \`setLogLevel\``
);
}
}
export function error(msg: string, ...obj: unknown[]): void {
if (logClient.logLevel <= FirebaseLogLevel.ERROR) {
const args = obj.map(argToString);
logClient.error(`Firestore (${SDK_VERSION}): ${msg}`, ...args);
}
}