mirror of
https://github.com/bourquep/mysa-js-sdk.git
synced 2026-02-04 09:41:07 +00:00
Added option to enable AWS CRT debug logging
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
CognitoUserPool,
|
||||
CognitoUserSession
|
||||
} from 'amazon-cognito-identity-js';
|
||||
import { iot, mqtt } from 'aws-iot-device-sdk-v2';
|
||||
import { io, iot, mqtt } from 'aws-iot-device-sdk-v2';
|
||||
import { hash } from 'crypto';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration.js';
|
||||
@@ -152,6 +152,10 @@ export class MysaApiClient {
|
||||
this._logger = options?.logger || new VoidLogger();
|
||||
this._fetcher = options?.fetcher || fetch;
|
||||
|
||||
if (options?.isAwsCrtDebugLoggingEnabled) {
|
||||
io.enable_logging(io.LogLevel.DEBUG);
|
||||
}
|
||||
|
||||
if (session) {
|
||||
this._cognitoUser = new CognitoUser({
|
||||
Username: session.username,
|
||||
|
||||
@@ -15,4 +15,11 @@ export interface MysaApiClientOptions {
|
||||
* @defaultValue The global `fetch` function.
|
||||
*/
|
||||
fetcher?: typeof fetch;
|
||||
|
||||
/**
|
||||
* Whether to enable debug logging for AWS CRT.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
isAwsCrtDebugLoggingEnabled?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user