Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bug]: Debug logging is not functional #1062

Open
4 tasks done
ari-at-backbone opened this issue Jan 9, 2025 · 1 comment
Open
4 tasks done

[Bug]: Debug logging is not functional #1062

ari-at-backbone opened this issue Jan 9, 2025 · 1 comment
Labels
type: community enhancement feature request not on Twilio's roadmap

Comments

@ari-at-backbone
Copy link

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.
  • This is not a general Twilio feature request or bug report. It is a feature request for the twilio-node JavaScript package.

Problem Description

Expected: https://github.com/twilio/twilio-node?tab=readme-ov-file#enable-debug-logging
Observed: HTTP requests are not logged using the latest release of twilio for node

Proposed Solution

Pass logLevel from the twilio client instance to the http request instance

Alternatives Considered

n/a

Additional Information

No response

@ari-at-backbone ari-at-backbone added the type: community enhancement feature request not on Twilio's roadmap label Jan 9, 2025
@ari-at-backbone
Copy link
Author

Here is a simple repro:

import twilio from "twilio";

const accountSid = process.env.TWILIO_ACCOUNT_SID || '';
const authToken = process.env.TWILIO_AUTH_TOKEN || '';

if (!accountSid || !authToken) {
    throw new Error('Twilio credentials are missing. Set TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN in your environment.');
}

export const twilioClient = twilio(accountSid, authToken, {
    logLevel: 'debug',
});

async function listUsageRecord() {
    console.log(twilioClient.logLevel); // prints `debug`
    const records = await twilioClient.usage.records.daily.list({ category: "sms-outbound", limit: 100, pageSize: 100 });
}

listUsageRecord().catch(console.error)

Simply debug is printed as opposed to expected HTTP calls.

@ari-at-backbone ari-at-backbone mentioned this issue Jan 9, 2025
8 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

1 participant