Add DEBUG RingCentral request logging
This commit is contained in:
parent
4da9429e6e
commit
3cf0188a8e
@ -4,6 +4,8 @@ import { Sonar, gql } from "./sonar";
|
|||||||
import { SDK } from "@ringcentral/sdk";
|
import { SDK } from "@ringcentral/sdk";
|
||||||
import { ticketize } from "./ticketize";
|
import { ticketize } from "./ticketize";
|
||||||
|
|
||||||
|
export const DEBUG = !!process.env.DEBUG;
|
||||||
|
|
||||||
function checkEnv() {
|
function checkEnv() {
|
||||||
[
|
[
|
||||||
"SONAR_URL",
|
"SONAR_URL",
|
||||||
@ -76,6 +78,13 @@ async function initRingCentralSDK() {
|
|||||||
password: process.env.RC_LOGIN_PASSWORD,
|
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();
|
const platform = sdk.platform();
|
||||||
platform.on(platform.events.refreshError, async (err) => {
|
platform.on(platform.events.refreshError, async (err) => {
|
||||||
console.error("Refresh token error:", err);
|
console.error("Refresh token error:", err);
|
||||||
|
Loading…
Reference in New Issue
Block a user