Added option to enable AWS CRT debug logging

This commit is contained in:
Pascal Bourque
2025-11-23 10:29:41 -05:00
parent f7c3dc07b3
commit 6c24d59760
3 changed files with 18 additions and 2 deletions

View File

@@ -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,