From 3cf0188a8e901ff7e3c5eef8f6ea7c72950d4477 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sun, 14 Mar 2021 12:26:44 -0600 Subject: [PATCH] Add DEBUG RingCentral request logging --- src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/index.ts b/src/index.ts index b1a6f59..ebd6535 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,8 @@ import { Sonar, gql } from "./sonar"; import { SDK } from "@ringcentral/sdk"; import { ticketize } from "./ticketize"; +export const DEBUG = !!process.env.DEBUG; + function checkEnv() { [ "SONAR_URL", @@ -76,6 +78,13 @@ async function initRingCentralSDK() { password: process.env.RC_LOGIN_PASSWORD, }); + if (DEBUG) { + const client = sdk.client(); + client.on(client.events.beforeRequest, (req) => { + console.log(req.url); + }); + } + const platform = sdk.platform(); platform.on(platform.events.refreshError, async (err) => { console.error("Refresh token error:", err);