Skip to content

Remove undocumented getLogLevel #3944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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