diff --git a/packages/core/__tests__/utils.test.ts b/packages/core/__tests__/utils.test.ts index a57207823ee..128e5eebbf5 100644 --- a/packages/core/__tests__/utils.test.ts +++ b/packages/core/__tests__/utils.test.ts @@ -8,10 +8,10 @@ import { } from '../src/utils'; import { Reachability as ReachabilityNative } from '../src/Reachability/Reachability.native'; import { Reachability } from '../src/Reachability/Reachability'; -import { ConsoleLogger as Logger } from '../src/Logger'; +import { ConsoleLogger } from '../src/Logger'; import { DateUtils } from '../src/Signer/DateUtils'; -Logger.LOG_LEVEL = 'DEBUG'; +ConsoleLogger.LOG_LEVEL = 'DEBUG'; describe('Util', () => { beforeEach(() => {}); diff --git a/packages/core/src/Cache/StorageCache.native.ts b/packages/core/src/Cache/StorageCache.native.ts index c8d5e57bd50..fa703d185c3 100644 --- a/packages/core/src/Cache/StorageCache.native.ts +++ b/packages/core/src/Cache/StorageCache.native.ts @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 import { loadAsyncStorage } from '@aws-amplify/react-native'; -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { defaultConfig } from './constants'; import { StorageCacheCommon } from './StorageCacheCommon'; import { Cache, CacheConfig } from './types'; import { getCurrentSizeKey, getCurrentTime } from './utils'; -const logger = new Logger('StorageCache'); +const logger = new ConsoleLogger('StorageCache'); const AsyncStorage = loadAsyncStorage(); /* diff --git a/packages/core/src/Cache/StorageCache.ts b/packages/core/src/Cache/StorageCache.ts index 406ca7bc76b..b80c87715f8 100644 --- a/packages/core/src/Cache/StorageCache.ts +++ b/packages/core/src/Cache/StorageCache.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { KeyValueStorage } from '../storage/KeyValueStorage'; import { getLocalStorageWithFallback } from '../storage/utils'; import { defaultConfig } from './constants'; @@ -9,7 +9,7 @@ import { StorageCacheCommon } from './StorageCacheCommon'; import { Cache, CacheConfig } from './types'; import { getCurrentSizeKey, getCurrentTime } from './utils'; -const logger = new Logger('Cache'); +const logger = new ConsoleLogger('StorageCache'); /** * Customized storage based on the SessionStorage or LocalStorage with LRU implemented diff --git a/packages/core/src/Cache/StorageCacheCommon.ts b/packages/core/src/Cache/StorageCacheCommon.ts index 126a0fb7462..860ee87d666 100644 --- a/packages/core/src/Cache/StorageCacheCommon.ts +++ b/packages/core/src/Cache/StorageCacheCommon.ts @@ -1,14 +1,14 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { KeyValueStorageInterface } from '../types'; import { currentSizeKey, defaultConfig } from './constants'; import { CacheConfig, CacheItem, CacheItemOptions } from './types'; import { getCurrentSizeKey, getCurrentTime, getByteLength } from './utils'; import { assert, CacheErrorCode } from './utils/errorHelpers'; -const logger = new Logger('StorageCache'); +const logger = new ConsoleLogger('StorageCache'); /** * Initialization of the cache diff --git a/packages/core/src/Hub/index.ts b/packages/core/src/Hub/index.ts index 6f6cb907140..e1808a345d9 100644 --- a/packages/core/src/Hub/index.ts +++ b/packages/core/src/Hub/index.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { NO_HUBCALLBACK_PROVIDED_EXCEPTION } from '../constants'; import { AmplifyError } from '../errors'; import { @@ -21,7 +21,7 @@ export const AMPLIFY_SYMBOL = ( : '@@amplify_default' ) as Symbol; -const logger = new Logger('Hub'); +const logger = new ConsoleLogger('Hub'); export class HubClass { name: string; diff --git a/packages/core/src/I18n/I18n.ts b/packages/core/src/I18n/I18n.ts index ee35c63d94d..91026ee18ba 100644 --- a/packages/core/src/I18n/I18n.ts +++ b/packages/core/src/I18n/I18n.ts @@ -1,11 +1,10 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../Logger'; -import { Amplify } from '../singleton'; +import { ConsoleLogger } from '../Logger'; import { I18nConfig } from './types'; -const logger = new Logger('I18n'); +const logger = new ConsoleLogger('I18n'); /** * Language translation utility. diff --git a/packages/core/src/I18n/index.ts b/packages/core/src/I18n/index.ts index 5a1b88ef443..97740114877 100644 --- a/packages/core/src/I18n/index.ts +++ b/packages/core/src/I18n/index.ts @@ -3,11 +3,11 @@ import { I18n as I18nClass } from './I18n'; -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { I18nConfig } from './types'; import { assert, I18nErrorCode } from './errorHelpers'; -const logger = new Logger('I18n'); +const logger = new ConsoleLogger('I18n'); let _config: I18nConfig = { language: null }; let _i18n: I18nClass | null = null; diff --git a/packages/core/src/Logger/ConsoleLogger.ts b/packages/core/src/Logger/ConsoleLogger.ts index adc824c30ed..a55e034173d 100644 --- a/packages/core/src/Logger/ConsoleLogger.ts +++ b/packages/core/src/Logger/ConsoleLogger.ts @@ -1,9 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { LoggingProvider, InputLogEvent } from '../types'; +import { InputLogEvent, Logger, LoggingProvider, LogType } from './types'; import { AWS_CLOUDWATCH_CATEGORY } from '../constants'; -import { Logger } from './logger-interface'; const LOG_LEVELS: Record = { VERBOSE: 1, @@ -13,21 +12,13 @@ const LOG_LEVELS: Record = { ERROR: 5, }; -export enum LOG_TYPE { - DEBUG = 'DEBUG', - ERROR = 'ERROR', - INFO = 'INFO', - WARN = 'WARN', - VERBOSE = 'VERBOSE', -} - /** * Write logs * @class Logger */ export class ConsoleLogger implements Logger { name: string; - level: LOG_TYPE | string; + level: LogType | string; private _pluggables: LoggingProvider[]; private _config?: object; @@ -35,13 +26,13 @@ export class ConsoleLogger implements Logger { * @constructor * @param {string} name - Name of the logger */ - constructor(name: string, level: LOG_TYPE | string = LOG_TYPE.WARN) { + constructor(name: string, level: LogType | string = LogType.WARN) { this.name = name; this.level = level; this._pluggables = []; } - static LOG_LEVEL = null; + static LOG_LEVEL: string | null = null; _padding(n: number) { return n < 10 ? '0' + n : '' + n; @@ -70,10 +61,10 @@ export class ConsoleLogger implements Logger { * Write log * @method * @memeberof Logger - * @param {LOG_TYPE|string} type - log type, default INFO + * @param {LogType|string} type - log type, default INFO * @param {string|object} msg - Logging message or object */ - _log(type: LOG_TYPE | string, ...msg: any) { + _log(type: LogType | string, ...msg: any) { let logger_level_name = this.level; if (ConsoleLogger.LOG_LEVEL) { logger_level_name = ConsoleLogger.LOG_LEVEL; @@ -89,10 +80,10 @@ export class ConsoleLogger implements Logger { } let log = console.log.bind(console); - if (type === LOG_TYPE.ERROR && console.error) { + if (type === LogType.ERROR && console.error) { log = console.error.bind(console); } - if (type === LOG_TYPE.WARN && console.warn) { + if (type === LogType.WARN && console.warn) { log = console.warn.bind(console); } @@ -130,7 +121,7 @@ export class ConsoleLogger implements Logger { * @param {string|object} msg - Logging message or object */ log(...msg: any) { - this._log(LOG_TYPE.INFO, ...msg); + this._log(LogType.INFO, ...msg); } /** @@ -140,7 +131,7 @@ export class ConsoleLogger implements Logger { * @param {string|object} msg - Logging message or object */ info(...msg: any) { - this._log(LOG_TYPE.INFO, ...msg); + this._log(LogType.INFO, ...msg); } /** @@ -150,7 +141,7 @@ export class ConsoleLogger implements Logger { * @param {string|object} msg - Logging message or object */ warn(...msg: any) { - this._log(LOG_TYPE.WARN, ...msg); + this._log(LogType.WARN, ...msg); } /** @@ -160,7 +151,7 @@ export class ConsoleLogger implements Logger { * @param {string|object} msg - Logging message or object */ error(...msg: any) { - this._log(LOG_TYPE.ERROR, ...msg); + this._log(LogType.ERROR, ...msg); } /** @@ -170,7 +161,7 @@ export class ConsoleLogger implements Logger { * @param {string|object} msg - Logging message or object */ debug(...msg: any) { - this._log(LOG_TYPE.DEBUG, ...msg); + this._log(LogType.DEBUG, ...msg); } /** @@ -180,7 +171,7 @@ export class ConsoleLogger implements Logger { * @param {string|object} msg - Logging message or object */ verbose(...msg: any) { - this._log(LOG_TYPE.VERBOSE, ...msg); + this._log(LogType.VERBOSE, ...msg); } addPluggable(pluggable: LoggingProvider) { diff --git a/packages/core/src/Logger/index.ts b/packages/core/src/Logger/index.ts index 8761b7bd354..dd924dca47d 100644 --- a/packages/core/src/Logger/index.ts +++ b/packages/core/src/Logger/index.ts @@ -1,4 +1,4 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -export { ConsoleLogger, LOG_TYPE } from './ConsoleLogger'; +export { ConsoleLogger } from './ConsoleLogger'; diff --git a/packages/core/src/Logger/logger-interface.ts b/packages/core/src/Logger/logger-interface.ts deleted file mode 100644 index 02632d441d4..00000000000 --- a/packages/core/src/Logger/logger-interface.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import { LoggingProvider } from '../types'; - -export interface Logger { - debug(msg: string): void; - info(msg: string): void; - warn(msg: string): void; - error(msg: string): void; - addPluggable(pluggable: LoggingProvider): void; -} diff --git a/packages/core/src/types/logging.ts b/packages/core/src/Logger/types.ts similarity index 65% rename from packages/core/src/types/logging.ts rename to packages/core/src/Logger/types.ts index 8a0a08c6fcf..6967d1d923b 100644 --- a/packages/core/src/types/logging.ts +++ b/packages/core/src/Logger/types.ts @@ -22,3 +22,19 @@ export interface LoggingProvider { // take logs and push to provider pushLogs(logs: InputLogEvent[]): void; } + +export interface Logger { + debug(msg: string): void; + info(msg: string): void; + warn(msg: string): void; + error(msg: string): void; + addPluggable(pluggable: LoggingProvider): void; +} + +export enum LogType { + DEBUG = 'DEBUG', + ERROR = 'ERROR', + INFO = 'INFO', + WARN = 'WARN', + VERBOSE = 'VERBOSE', +} diff --git a/packages/core/src/Reachability/Reachability.native.ts b/packages/core/src/Reachability/Reachability.native.ts index c459657ab24..dda3bd1770e 100644 --- a/packages/core/src/Reachability/Reachability.native.ts +++ b/packages/core/src/Reachability/Reachability.native.ts @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import { Observable } from 'rxjs'; import { loadNetInfo } from '@aws-amplify/react-native'; -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { NetworkStatus } from './types'; -const logger = new Logger('Reachability', 'DEBUG'); +const logger = new ConsoleLogger('Reachability', 'DEBUG'); export class Reachability { networkMonitor( diff --git a/packages/core/src/ServiceWorker/ServiceWorker.ts b/packages/core/src/ServiceWorker/ServiceWorker.ts index d7abfede978..6683b8a4fc1 100644 --- a/packages/core/src/ServiceWorker/ServiceWorker.ts +++ b/packages/core/src/ServiceWorker/ServiceWorker.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../Logger'; +import { ConsoleLogger } from '../Logger'; import { isBrowser } from '../utils'; import { AmplifyError } from '../errors'; import { assert, ServiceWorkerErrorCode } from './errorHelpers'; @@ -35,7 +35,7 @@ export class ServiceWorkerClass { private _subscription?: PushSubscription; // The AWS Amplify logger - private _logger: Logger = new Logger('ServiceWorker'); + private _logger: ConsoleLogger = new ConsoleLogger('ServiceWorker'); constructor() {} diff --git a/packages/core/src/parseAWSExports.ts b/packages/core/src/parseAWSExports.ts index 51719f0410e..96cb0afc870 100644 --- a/packages/core/src/parseAWSExports.ts +++ b/packages/core/src/parseAWSExports.ts @@ -1,6 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from './Logger'; +import { ConsoleLogger } from './Logger'; import { OAuthConfig, AuthConfigUserAttributes, @@ -8,7 +8,7 @@ import { } from './singleton/Auth/types'; import { ResourcesConfig } from './singleton/types'; -const logger = new Logger('parseAWSExports'); +const logger = new ConsoleLogger('parseAWSExports'); const authTypeMapping: Record = { API_KEY: 'apiKey', diff --git a/packages/core/src/providers/pinpoint/utils/PinpointEventBuffer.ts b/packages/core/src/providers/pinpoint/utils/PinpointEventBuffer.ts index 55e7ce02be7..f833e01feca 100644 --- a/packages/core/src/providers/pinpoint/utils/PinpointEventBuffer.ts +++ b/packages/core/src/providers/pinpoint/utils/PinpointEventBuffer.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../../../Logger'; +import { ConsoleLogger } from '../../../Logger'; import { EventsBatch, putEvents, @@ -17,7 +17,7 @@ import { import { AuthSession } from '../../../singleton/Auth/types'; import { isAppInForeground } from './isAppInForeground'; -const logger = new Logger('PinpointEventBuffer'); +const logger = new ConsoleLogger('PinpointEventBuffer'); const RETRYABLE_CODES = [429, 500]; const ACCEPTED_CODES = [202]; diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index 0a250d64321..582907f7acd 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -3,5 +3,4 @@ export * from './core'; export * from './errors'; -export * from './logging'; export * from './storage'; diff --git a/packages/core/src/utils/getClientInfo/getClientInfo.android.ts b/packages/core/src/utils/getClientInfo/getClientInfo.android.ts index cb842903ca8..24626eef935 100644 --- a/packages/core/src/utils/getClientInfo/getClientInfo.android.ts +++ b/packages/core/src/utils/getClientInfo/getClientInfo.android.ts @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // @ts-ignore: missing type definition import { Platform, Dimensions } from 'react-native'; -import { ConsoleLogger as Logger } from '../../Logger'; +import { ConsoleLogger } from '../../Logger'; -const logger = new Logger('DeviceInfo'); +const logger = new ConsoleLogger('getClientInfo'); export const getClientInfo = () => { const dim = Dimensions.get('screen'); diff --git a/packages/core/src/utils/getClientInfo/getClientInfo.ios.ts b/packages/core/src/utils/getClientInfo/getClientInfo.ios.ts index de2edb02a2e..215b63e1fec 100644 --- a/packages/core/src/utils/getClientInfo/getClientInfo.ios.ts +++ b/packages/core/src/utils/getClientInfo/getClientInfo.ios.ts @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // @ts-ignore: missing type definition import { Platform, Dimensions } from 'react-native'; -import { ConsoleLogger as Logger } from '../../Logger'; +import { ConsoleLogger } from '../../Logger'; -const logger = new Logger('DeviceInfo'); +const logger = new ConsoleLogger('getClientInfo'); export const getClientInfo = () => { const dim = Dimensions.get('screen'); diff --git a/packages/core/src/utils/getClientInfo/getClientInfo.ts b/packages/core/src/utils/getClientInfo/getClientInfo.ts index ca573f397a6..b729e31de17 100644 --- a/packages/core/src/utils/getClientInfo/getClientInfo.ts +++ b/packages/core/src/utils/getClientInfo/getClientInfo.ts @@ -1,8 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '../../Logger'; +import { ConsoleLogger } from '../../Logger'; -const logger = new Logger('ClientDevice_Browser'); +const logger = new ConsoleLogger('getClientInfo'); export function getClientInfo() { if (typeof window === 'undefined') { diff --git a/packages/core/src/utils/retry/retry.ts b/packages/core/src/utils/retry/retry.ts index 250a1464819..dfa27f51c1d 100644 --- a/packages/core/src/utils/retry/retry.ts +++ b/packages/core/src/utils/retry/retry.ts @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import { DelayFunction } from '../../types'; -import { ConsoleLogger as Logger } from '../../Logger/ConsoleLogger'; +import { ConsoleLogger } from '../../Logger/ConsoleLogger'; import { isNonRetryableError } from './isNonRetryableError'; -const logger = new Logger('Util'); +const logger = new ConsoleLogger('retryUtil'); /** * @private diff --git a/packages/datastore/docs/getting-started.md b/packages/datastore/docs/getting-started.md index 9e703789395..4334fcb0692 100644 --- a/packages/datastore/docs/getting-started.md +++ b/packages/datastore/docs/getting-started.md @@ -16,7 +16,7 @@ 6. While interacting with your app, examine the IndexedDB tables (Application > IndexedDB within Chrome dev tools): 1. Check out the different stores in IDB that get created for your schema. Note the internal stores prefixed with sync_, and the stores corresponding to your models prefixed with user_. 2. Familiarize yourself with how actions taken in the UI affect the data stored in IDB. This may be easier to do while throttling the network connection. You'll be able to see how outgoing mutations first get persisted into the corresponding store, then added to the mutation queue / outbox (sync_MutationEvent), and then updated in the store with data from AppSync. -7. Turn on DEBUG logging (`Amplify.Logger.LOG_LEVEL = "DEBUG";`) at the root of your project, and inspect the logs in the console while using your app. Additionally, [enable hub events](https://docs.amplify.aws/lib/datastore/datastore-events/q/platform/js#usage) for DataStore. +7. Turn on DEBUG logging (`ConsoleLogger.LOG_LEVEL = "DEBUG";`) at the root of your project, and inspect the logs in the console while using your app. Additionally, [enable hub events](https://docs.amplify.aws/lib/datastore/datastore-events/q/platform/js#usage) for DataStore. 8. The best way to understand DataStore events is to place several debuggers or breakpoints throughout DataStore. - With logging / Hub events enabled, you can see what operations DataStore is performing (i.e. start, sync, etc.) as you step through with the debugger. 9. Testing offline scenerios / concurrent user sessions is a useful way to test the full functionality of DataStore, and to fully understand how the sync process actually works. diff --git a/packages/predictions/src/Predictions.ts b/packages/predictions/src/Predictions.ts index 2df7d658f60..97d699abb14 100644 --- a/packages/predictions/src/Predictions.ts +++ b/packages/predictions/src/Predictions.ts @@ -1,6 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as Logger } from '@aws-amplify/core'; +import { ConsoleLogger } from '@aws-amplify/core'; import { AmazonAIConvertPredictionsProvider, AmazonAIIdentifyPredictionsProvider, @@ -23,7 +23,7 @@ import { TranslateTextOutput, } from './types'; -const logger = new Logger('Predictions'); +const logger = new ConsoleLogger('Predictions'); export class PredictionsClass { private convertProvider = new AmazonAIConvertPredictionsProvider(); diff --git a/packages/predictions/src/providers/AmazonAIConvertPredictionsProvider.ts b/packages/predictions/src/providers/AmazonAIConvertPredictionsProvider.ts index e2da48c0651..77beadfd21d 100644 --- a/packages/predictions/src/providers/AmazonAIConvertPredictionsProvider.ts +++ b/packages/predictions/src/providers/AmazonAIConvertPredictionsProvider.ts @@ -1,10 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { - Amplify, - ConsoleLogger as Logger, - fetchAuthSession, -} from '@aws-amplify/core'; +import { Amplify, ConsoleLogger, fetchAuthSession } from '@aws-amplify/core'; import { AWSCredentials, Category, @@ -40,7 +36,7 @@ import { isValidConvertInput, } from '../types'; -const logger = new Logger('AmazonAIConvertPredictionsProvider'); +const logger = new ConsoleLogger('AmazonAIConvertPredictionsProvider'); const eventBuilder = new EventStreamCodec(toUtf8, fromUtf8); const LANGUAGES_CODE_IN_8KHZ = ['fr-FR', 'en-AU', 'en-GB', 'fr-CA']; diff --git a/packages/predictions/src/providers/AmazonAIIdentifyPredictionsProvider.ts b/packages/predictions/src/providers/AmazonAIIdentifyPredictionsProvider.ts index 057d8915565..006f68a1d7a 100644 --- a/packages/predictions/src/providers/AmazonAIIdentifyPredictionsProvider.ts +++ b/packages/predictions/src/providers/AmazonAIIdentifyPredictionsProvider.ts @@ -1,10 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { - Amplify, - ConsoleLogger as Logger, - fetchAuthSession, -} from '@aws-amplify/core'; +import { Amplify, ConsoleLogger, fetchAuthSession } from '@aws-amplify/core'; import { Category, PredictionsAction, @@ -66,7 +62,7 @@ import { } from './IdentifyTextUtils'; import { blobToArrayBuffer, makeCamelCase, makeCamelCaseArray } from './Utils'; -const logger = new Logger('AmazonAIIdentifyPredictionsProvider'); +const logger = new ConsoleLogger('AmazonAIIdentifyPredictionsProvider'); export class AmazonAIIdentifyPredictionsProvider { private rekognitionClient?: RekognitionClient; diff --git a/packages/pubsub/src/Providers/MqttOverWS.ts b/packages/pubsub/src/Providers/MqttOverWS.ts index 1d3444036d9..ea943b88bbb 100644 --- a/packages/pubsub/src/Providers/MqttOverWS.ts +++ b/packages/pubsub/src/Providers/MqttOverWS.ts @@ -14,7 +14,7 @@ import { PublishInput, SubscribeInput, } from '../types/PubSub'; -import { Hub, HubPayload, ConsoleLogger as Logger } from '@aws-amplify/core'; +import { Hub, HubPayload, ConsoleLogger } from '@aws-amplify/core'; import { amplifyUuid } from '@aws-amplify/core/internals/utils'; import { ConnectionStateMonitor, @@ -26,7 +26,7 @@ import { } from '../utils/ReconnectionMonitor'; import { AMPLIFY_SYMBOL, CONNECTION_STATE_CHANGE } from './constants'; -const logger = new Logger('MqttOverWS'); +const logger = new ConsoleLogger('MqttOverWS'); export function mqttTopicMatch(filter: string, topic: string) { const filterArray = filter.split('/'); diff --git a/packages/pubsub/src/Providers/PubSub.ts b/packages/pubsub/src/Providers/PubSub.ts index 78a7eec9141..5750d0a1940 100644 --- a/packages/pubsub/src/Providers/PubSub.ts +++ b/packages/pubsub/src/Providers/PubSub.ts @@ -8,8 +8,8 @@ import { PublishInput, SubscribeInput, } from '../types/PubSub'; -import { ConsoleLogger as Logger } from '@aws-amplify/core'; -const logger = new Logger('AbstractPubSubProvider'); +import { ConsoleLogger } from '@aws-amplify/core'; +const logger = new ConsoleLogger('AbstractPubSubProvider'); export abstract class AbstractPubSub implements PubSubBase