fix: remove debug logs and clean up verbose logging (#25896)
- Remove debug console.log statements in calendar and video adapter services - Clean up verbose request/response logging in OAuth controllers - Remove leftover debug prefixes Ensure only necessary data is captured in observability systems Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
co-authored by
Keith Williams
parent
486817a688
commit
b08997b553
@@ -75,7 +75,6 @@ export class CalendarsService {
|
||||
eventTypeId: null,
|
||||
prisma: this.dbWrite.prisma as unknown as PrismaClient,
|
||||
});
|
||||
console.log("saving cache", JSON.stringify(result));
|
||||
await this.calendarsCacheService.setConnectedAndDestinationCalendarsCache(userId, result);
|
||||
|
||||
return result;
|
||||
|
||||
+2
-4
@@ -84,9 +84,7 @@ export class OAuthClientUsersController {
|
||||
@Param("clientId") oAuthClientId: string,
|
||||
@Body() body: CreateManagedUserInput
|
||||
): Promise<CreateManagedUserOutput> {
|
||||
this.logger.log(
|
||||
`Creating user with data: ${JSON.stringify(body, null, 2)} for OAuth Client with ID ${oAuthClientId}`
|
||||
);
|
||||
this.logger.log(`Creating user for OAuth Client ${oAuthClientId}`);
|
||||
const client = await this.oauthRepository.getOAuthClient(oAuthClientId);
|
||||
if (!client) {
|
||||
throw new NotFoundException(`OAuth Client with ID ${oAuthClientId} not found`);
|
||||
@@ -133,7 +131,7 @@ export class OAuthClientUsersController {
|
||||
@GetOrgId() organizationId: number
|
||||
): Promise<GetManagedUserOutput> {
|
||||
await this.validateManagedUserOwnership(clientId, userId);
|
||||
this.logger.log(`Updating user with ID ${userId}: ${JSON.stringify(body, null, 2)}`);
|
||||
this.logger.log(`Updating user ${userId} for OAuth Client ${clientId}`);
|
||||
|
||||
const user = await this.oAuthClientUsersService.updateOAuthClientUser(
|
||||
clientId,
|
||||
|
||||
+2
-4
@@ -69,9 +69,7 @@ export class OAuthClientsController {
|
||||
@GetOrgId() organizationId: number,
|
||||
@Body() body: CreateOAuthClientInput
|
||||
): Promise<CreateOAuthClientResponseDto> {
|
||||
this.logger.log(
|
||||
`For organisation ${organizationId} creating OAuth Client with data: ${JSON.stringify(body)}`
|
||||
);
|
||||
this.logger.log(`Creating OAuth Client for organisation ${organizationId}`);
|
||||
|
||||
const organization = await this.teamsRepository.findByIdIncludeBilling(organizationId);
|
||||
if (!organization?.platformBilling || !organization?.platformBilling?.subscriptionId) {
|
||||
@@ -140,7 +138,7 @@ export class OAuthClientsController {
|
||||
@Param("clientId") clientId: string,
|
||||
@Body() body: UpdateOAuthClientInput
|
||||
): Promise<GetOAuthClientResponseDto> {
|
||||
this.logger.log(`For client ${clientId} updating OAuth Client with data: ${JSON.stringify(body)}`);
|
||||
this.logger.log(`Updating OAuth Client ${clientId}`);
|
||||
const client = await this.oAuthClientsService.updateOAuthClient(clientId, body);
|
||||
return { status: SUCCESS_STATUS, data: client };
|
||||
}
|
||||
|
||||
@@ -135,7 +135,6 @@ export class TeamsEventTypesService {
|
||||
});
|
||||
|
||||
const eventType = await this.teamsEventTypesRepository.getEventTypeById(eventTypeId);
|
||||
this.logger.debug("nl debug - update team event type - eventType", JSON.stringify(eventType, null, 2));
|
||||
|
||||
if (!eventType) {
|
||||
throw new NotFoundException(`Event type with id ${eventTypeId} not found`);
|
||||
|
||||
@@ -55,7 +55,6 @@ export class PaymentService implements IAbstractPaymentService {
|
||||
referenceId: uid,
|
||||
},
|
||||
});
|
||||
console.log("Created invoice", invoice, uid);
|
||||
|
||||
const paymentData = await prisma.payment.create({
|
||||
data: {
|
||||
|
||||
@@ -38,7 +38,6 @@ const getO365VideoAppKeys = async () => {
|
||||
};
|
||||
|
||||
const TeamsVideoApiAdapter = (credential: CredentialForCalendarServiceWithTenantId): VideoApiAdapter => {
|
||||
console.log("TeamsVideoApiAdapter--credential: ", credential);
|
||||
let azureUserId: string | null;
|
||||
const tokenResponse = oAuthManagerHelper.getTokenObjectFromCredential(credential);
|
||||
|
||||
@@ -251,11 +250,7 @@ const TeamsVideoApiAdapter = (credential: CredentialForCalendarServiceWithTenant
|
||||
return Promise.resolve([]);
|
||||
},
|
||||
createMeeting: async (event: CalendarEvent): Promise<VideoCallData> => {
|
||||
console.log("=======>createMeeting: ");
|
||||
|
||||
const url = `${await getUserEndpoint()}/onlineMeetings`;
|
||||
console.log("urllllllllllll: ", url);
|
||||
console.log("translateEvent(event): ", translateEvent(event));
|
||||
const resultString = await auth
|
||||
.requestRaw({
|
||||
url,
|
||||
|
||||
@@ -112,7 +112,7 @@ const webexAuth = (credential: CredentialPayload) => {
|
||||
let credentialKey: WebexToken | null = null;
|
||||
try {
|
||||
credentialKey = webexTokenSchema.parse(credential.key);
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return Promise.reject("Webex credential keys parsing error");
|
||||
}
|
||||
|
||||
@@ -148,8 +148,6 @@ const WebexVideoApiAdapter = (credential: CredentialPayload): VideoApiAdapter =>
|
||||
const fetchWebexApi = async (endpoint: string, options?: RequestInit) => {
|
||||
const auth = webexAuth(credential);
|
||||
const accessToken = await auth.getToken();
|
||||
console.log("result of accessToken in fetchWebexApi", accessToken);
|
||||
console.log("createMeeting options in fetchWebexApi", options);
|
||||
const response = await fetch(`https://webexapis.com/v1/${endpoint}`, {
|
||||
method: "GET",
|
||||
...options,
|
||||
@@ -181,9 +179,6 @@ const WebexVideoApiAdapter = (credential: CredentialPayload): VideoApiAdapter =>
|
||||
createMeeting: async (event: CalendarEvent): Promise<VideoCallData> => {
|
||||
/** @link https://developer.webex.com/docs/api/v1/meetings/create-a-meeting */
|
||||
try {
|
||||
console.log("Creating meeting", event);
|
||||
console.log("meting body", translateEvent(event));
|
||||
console.log("request body in createMeeting", JSON.stringify(translateEvent(event)));
|
||||
const response = await fetchWebexApi("meetings", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -191,7 +186,6 @@ const WebexVideoApiAdapter = (credential: CredentialPayload): VideoApiAdapter =>
|
||||
},
|
||||
body: JSON.stringify(translateEvent(event)),
|
||||
});
|
||||
console.log("Webex create meeting response", response);
|
||||
if (response.error) {
|
||||
if (response.error === "invalid_grant") {
|
||||
await invalidateCredential(credential.id);
|
||||
@@ -220,7 +214,6 @@ const WebexVideoApiAdapter = (credential: CredentialPayload): VideoApiAdapter =>
|
||||
const response = await fetchWebexApi(`meetings/${uid}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
console.log("Webex delete meeting response", response);
|
||||
if (response.error) {
|
||||
if (response.error === "invalid_grant") {
|
||||
await invalidateCredential(credential.id);
|
||||
@@ -228,7 +221,7 @@ const WebexVideoApiAdapter = (credential: CredentialPayload): VideoApiAdapter =>
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return Promise.reject(new Error("Failed to delete meeting"));
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user