Skip to content

Commit 092bce3

Browse files
committed
add logs for debugginh
1 parent 2d5f193 commit 092bce3

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/connect_repo/s3_uploader.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ class s3Uploader extends s3UploaderUtils {
274274
}
275275

276276
createTasks = async (content: IS3UploaderFile) => {
277+
CodeSyncLogger.debug(`CodeSync: createTasks`);
277278
// Proceess the given file and create parallelTasks
278279
const pathUtils_ = new pathUtils(this.repoPath, content.branch);
279280
this.originalsRepoBranchPath = pathUtils_.getOriginalsRepoBranchPath();
@@ -297,13 +298,17 @@ class s3Uploader extends s3UploaderUtils {
297298
this.tasks.push(async function (callback: any) {
298299
const userUtils = new UserUtils();
299300
const activeUser: any = userUtils.getActiveUser();
301+
CodeSyncLogger.debug(`CodeSync: activeUser`, activeUser);
300302
let users = <any>{};
301303
users = readYML(generateSettings().USER_PATH) || {};
302304
let json: any = null;
303305
let key: any= null;
304306
if (activeUser && activeUser?.email in users) {
305307
key = users[activeUser.email].gcp_private_key;
308+
CodeSyncLogger.debug(`CodeSync: key `, key);
306309
}
310+
311+
CodeSyncLogger.debug(`CodeSync: key before use`, key);
307312
if (key) {
308313
json = <any>await uploadFileToGCS(originalsFilePath, presignedURL);
309314
} else {

src/connect_repo/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class initUtils {
138138
}
139139
}
140140
}
141-
console.log("CodeSync: users in IamUser", users);
141+
CodeSyncLogger.debug("CodeSync: users in IamUser", users);
142142
fs.writeFileSync(this.settings.USER_PATH, yaml.dump(users));
143143
}
144144

src/logger.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export class CodeSyncLogger {
6161
ERROR: Errors that cause a bad UX and should be fixed soon.
6262
CRITICAL: Errors that are blocking for the normal operation of the plugin and should be fixed immediately.
6363
*/
64-
private cloudService = <string>"";
64+
private cloudService = <string | null>null;
65+
// static cloudService: string;
6566

6667
constructor() {
6768
console.log("CodeSync: Initializing CodeSyncLogger...");
@@ -72,7 +73,7 @@ export class CodeSyncLogger {
7273
const activeUser: any = userUtils.getActiveUser();
7374

7475
if (!activeUser || !users) {
75-
console.warn("⚠️ No active user or users data found.");
76+
console.warn("CodeSync: ⚠️ No active user or users data found.");
7677
return;
7778
}
7879

@@ -83,6 +84,7 @@ export class CodeSyncLogger {
8384
}
8485

8586
static async debug(msg: string, additionalMsg = "", logStream?: string) {
87+
// const cloudService = this.cloudService ?? "s";
8688
await putLogEvent(msg, logErrorMsgTypes.DEBUG, additionalMsg, logStream);
8789
}
8890

src/utils/setup_utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ export const setupCodeSync = async (repoPath: string) => {
174174
}
175175
// Check is accessToken is valid
176176
const isUserActive = await isAccountActive(activeUser.email, activeUser.access_token);
177-
if (!isUserActive) return;
178-
CodeSyncLogger.debug(`User's access token is active, user=${activeUser.email}`);
179-
CodeSyncLogger.warning(`xD User's access token is active, user=${activeUser.email}`);
177+
if (!isUserActive) return;
180178
// Show Repo Status
181179
showRepoStatusMsg(repoPath);
182180
};

src/utils/upload_utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export const uploadFileTos3 = async (filePath: string, presignedUrl: any) => {
166166
};
167167

168168
export const uploadFileToGCS = async (filePath: string, signedUrl: any) => {
169+
CodeSyncLogger.debug("CodeSync: uploadFileToGCS");
169170
if (!fs.existsSync(filePath)) {
170171
return {
171172
error: `uploadFileToGCS: File=${filePath} not found`

0 commit comments

Comments
 (0)