Skip to content

Commit 144e9e4

Browse files
committed
Added licensing to logger file
1 parent 2fbfba2 commit 144e9e4

File tree

7 files changed

+28
-21
lines changed

7 files changed

+28
-21
lines changed

packages/data-connect/src/api/DataConnect.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class DataConnect {
8787
if (typeof process !== 'undefined' && process.env) {
8888
const host = process.env[FIREBASE_DATA_CONNECT_EMULATOR_HOST_VAR];
8989
if (host) {
90-
logger.info("Found custom host. Using emulator");
90+
logger.info('Found custom host. Using emulator');
9191
this.isEmulator = true;
9292
this.transportOptions = parseOptions(host);
9393
}
@@ -113,7 +113,7 @@ export class DataConnect {
113113
return;
114114
}
115115
if (this.transportClass === undefined) {
116-
logger.info("transportClass not provided. Defaulting to RESTTransport.");
116+
logger.info('transportClass not provided. Defaulting to RESTTransport.');
117117
this.transportClass = RESTTransport;
118118
}
119119

@@ -150,7 +150,7 @@ export class DataConnect {
150150

151151
enableEmulator(transportOptions: TransportOptions) {
152152
if (this.initialized) {
153-
logger.error("enableEmulator called without initializing");
153+
logger.error('enableEmulator called without initializing');
154154
throw new DataConnectError(
155155
Code.ALREADY_INITIALIZED,
156156
'DataConnect instance already initialized!'
@@ -199,14 +199,14 @@ export function getDataConnect(
199199
const options = provider.getOptions(identifier);
200200
const optionsValid = Object.keys(options).length > 0;
201201
if (optionsValid) {
202-
logger.debug("Re-using cached instance");
202+
logger.debug('Re-using cached instance');
203203
return dcInstance;
204204
}
205205
}
206206
if (!dcOptions) {
207207
throw new DataConnectError(Code.INVALID_ARGUMENT, 'DC Option Required');
208208
}
209-
logger.debug("Creating new DataConnect instance");
209+
logger.debug('Creating new DataConnect instance');
210210
// Initialize with options.
211211
return provider.initialize({
212212
instanceIdentifier: identifier,

packages/data-connect/src/core/FirebaseAuthProvider.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ export class FirebaseAuthProvider implements AuthTokenProvider {
5656
}
5757
return this.auth_.getToken(forceRefresh).catch(error => {
5858
if (error && error.code === 'auth/token-not-initialized') {
59-
logger.debug(
60-
'Got auth/token-not-initialized error. Treating as null token.'
61-
);
59+
logger.debug(
60+
'Got auth/token-not-initialized error. Treating as null token.'
61+
);
6262
return null;
6363
} else {
64-
logger.error(
65-
'Error received when attempting to retrieve token: ' + JSON.stringify(error)
66-
);
64+
logger.error(
65+
'Error received when attempting to retrieve token: ' +
66+
JSON.stringify(error)
67+
);
6768
return Promise.reject(error);
6869
}
6970
});

packages/data-connect/src/core/QueryManager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ export class QueryManager {
155155
unsubscribe
156156
});
157157
if (!trackedQuery.currentCache) {
158-
logger.info(`No cache available for query ${queryRef.name} with variables ${JSON.stringify(queryRef.variables)}. Calling executeQuery.`);
158+
logger.info(
159+
`No cache available for query ${
160+
queryRef.name
161+
} with variables ${JSON.stringify(
162+
queryRef.variables
163+
)}. Calling executeQuery.`
164+
);
159165
const promise = this.executeQuery(
160166
queryRef as QueryRef<Response, Variables>
161167
);

packages/data-connect/src/network/fetch.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,19 @@ export function dcFetch<T, U>(
5353
throw new DataConnectError(Code.OTHER, JSON.stringify(e));
5454
}
5555
if (response.status >= 400) {
56-
logger.error("Error while performing request: " + JSON.stringify(jsonResponse));
56+
logger.error(
57+
'Error while performing request: ' + JSON.stringify(jsonResponse)
58+
);
5759
throw new DataConnectError(Code.OTHER, JSON.stringify(jsonResponse));
5860
}
5961
return jsonResponse;
6062
})
6163
.then(res => {
6264
if (res.errors && res.errors.length) {
6365
const stringified = JSON.stringify(res.errors);
64-
logger.error("DataConnect error while performing request: " + stringified);
66+
logger.error(
67+
'DataConnect error while performing request: ' + stringified
68+
);
6569
throw new DataConnectError(Code.OTHER, stringified);
6670
}
6771
return res as { data: T; errors: Error[] };

packages/data-connect/src/network/transport/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
*/
1717

1818
import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
19-
import {
20-
AuthTokenProvider,
21-
} from '../../core/FirebaseAuthProvider';
19+
import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
2220

2321
// Change this to only specify specific args.
2422
export interface DataConnectTransport {

packages/data-connect/src/network/transport/rest.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
import { DataConnectTransport } from '.';
1919
import { DataConnectOptions, TransportOptions } from '../../api/DataConnect';
2020
import { DataConnectError, Code } from '../../core/error';
21-
import {
22-
AuthTokenProvider,
23-
} from '../../core/FirebaseAuthProvider';
21+
import { AuthTokenProvider } from '../../core/FirebaseAuthProvider';
2422
import { addToken, urlBuilder } from '../../util/url';
2523
import { dcFetch } from '../fetch';
2624

packages/data-connect/src/util/url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function urlBuilder(
3131
if (typeof port === 'number') {
3232
baseUrl += `:${port}`;
3333
} else if (typeof port !== 'undefined') {
34-
logger.error("Port type is of an invalid type");
34+
logger.error('Port type is of an invalid type');
3535
throw new DataConnectError(
3636
Code.INVALID_ARGUMENT,
3737
'Incorrect type for port passed in!'

0 commit comments

Comments
 (0)