Skip to content

Commit

Permalink
Remove undocumented getLogLevel (#3944)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian authored Oct 15, 2020
1 parent ffef32e commit 8939aec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
6 changes: 6 additions & 0 deletions .changeset/great-rice-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"firebase": major
"@firebase/firestore": major
---

Removed the undocumented `Firestore.logLevel` property.
44 changes: 12 additions & 32 deletions packages/firestore/src/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ import {
valueDescription,
validateIsNotUsedTogether
} from '../util/input_validation';
import { getLogLevel, logError, LogLevel, setLogLevel } from '../util/log';
import { logError, setLogLevel as setClientLogLevel } from '../util/log';
import { AutoId } from '../util/misc';
import { Deferred } from '../util/promise';
import { FieldPath as ExternalFieldPath } from './field_path';
Expand Down Expand Up @@ -752,43 +752,23 @@ export class Firestore implements PublicFirestore, FirebaseService {
return new WriteBatch(this);
}

static get logLevel(): PublicLogLevel {
switch (getLogLevel()) {
case LogLevel.DEBUG:
return 'debug';
case LogLevel.ERROR:
return 'error';
case LogLevel.SILENT:
return 'silent';
case LogLevel.WARN:
return 'warn';
case LogLevel.INFO:
return 'info';
case LogLevel.VERBOSE:
return 'verbose';
default:
// The default log level is error
return 'error';
}
}

static setLogLevel(level: PublicLogLevel): void {
validateExactNumberOfArgs('Firestore.setLogLevel', arguments, 1);
validateStringEnum(
'setLogLevel',
['debug', 'error', 'silent', 'warn', 'info', 'verbose'],
1,
level
);
setLogLevel(level);
}

// Visible for testing.
_getSettings(): PublicSettings {
return this._settings;
}
}

export function setLogLevel(level: PublicLogLevel): void {
validateExactNumberOfArgs('Firestore.setLogLevel', arguments, 1);
validateStringEnum(
'setLogLevel',
['debug', 'error', 'silent', 'warn', 'info', 'verbose'],
1,
level
);
setClientLogLevel(level);
}

/**
* A reference to a transaction.
*/
Expand Down
5 changes: 3 additions & 2 deletions packages/firestore/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import {
QueryDocumentSnapshot,
QuerySnapshot,
Transaction,
WriteBatch
WriteBatch,
setLogLevel
} from './api/database';
import { Blob } from './api/blob';
import { FieldPath } from './api/field_path';
Expand All @@ -52,7 +53,7 @@ const firestoreNamespace = {
CollectionReference,
FieldPath,
FieldValue,
setLogLevel: Firestore.setLogLevel,
setLogLevel,
CACHE_SIZE_UNLIMITED
};

Expand Down

0 comments on commit 8939aec

Please sign in to comment.