Skip to content

Commit

Permalink
fix: allow setLogFunction(null) (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Sep 22, 2020
1 parent 404699a commit 20b1226
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dev/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function logger(
* `null` to turn off logging.
*/
export function setLogFunction(logger: ((msg: string) => void) | null): void {
validateFunction('logger', logger);
if (logger !== null) validateFunction('logger', logger);
logFunction = logger;
}

Expand Down
2 changes: 1 addition & 1 deletion dev/test/bulk-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
import api = proto.google.firestore.v1;

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

const PROJECT_ID = 'test-project';

Expand Down
2 changes: 1 addition & 1 deletion dev/test/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from './util/helpers';

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

describe('Collection interface', () => {
let firestore: Firestore;
Expand Down
2 changes: 1 addition & 1 deletion dev/test/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const INVALID_ARGUMENTS_TO_UPDATE = new RegExp(
);

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

describe('DocumentReference interface', () => {
let firestore: Firestore;
Expand Down
2 changes: 1 addition & 1 deletion dev/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const DEFAULT_SETTINGS = {
};

// Change the argument to 'console.log' to enable debug output.
Firestore.setLogFunction(() => {});
Firestore.setLogFunction(null);

const bytesData = Buffer.from('AQI=', 'base64');

Expand Down
2 changes: 1 addition & 1 deletion dev/test/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {createInstance, InvalidApiUsage, verifyInstance} from './util/helpers';
import api = google.firestore.v1;

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

describe('Order', () => {
let firestore: Firestore;
Expand Down
2 changes: 1 addition & 1 deletion dev/test/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const PROJECT_ID = 'test-project';
const DATABASE_ROOT = `projects/${PROJECT_ID}/databases/(default)`;

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

use(chaiAsPromised);

Expand Down
2 changes: 1 addition & 1 deletion dev/test/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DOCUMENT_ID = 'documentId';
const DOCUMENT_NAME = `${COLLECTION_ROOT}/${DOCUMENT_ID}`;

// Change the argument to 'console.log' to enable debug output.
Firestore.setLogFunction(() => {});
Firestore.setLogFunction(null);

/** Helper to create a transaction ID from either a string or a Uint8Array. */
function transactionId(transaction?: Uint8Array | string): Uint8Array {
Expand Down
2 changes: 1 addition & 1 deletion dev/test/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {createInstance, InvalidApiUsage, verifyInstance} from './util/helpers';
import api = google.firestore.v1;

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

let PROJECT_ID = process.env.PROJECT_ID;
if (!PROJECT_ID) {
Expand Down
2 changes: 1 addition & 1 deletion dev/test/write-batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
const REQUEST_TIME = 'REQUEST_TIME';

// Change the argument to 'console.log' to enable debug output.
setLogFunction(() => {});
setLogFunction(null);

const PROJECT_ID = 'test-project';

Expand Down

0 comments on commit 20b1226

Please sign in to comment.