Skip to content

[Feature]: Stop polluting stdout (via lots of console.log calls) #8

@thomasdondorf

Description

@thomasdondorf

Tell us about your feature request

By default, this library is very chatty and prints a lot of actions to console/stdout. This might interfere with other log output and also does not work well together with other logging systems.

Example:

const paddle = new Paddle(process.env.PADDLE_API_KEY, {
    environment: Environment.sandbox,
});
const eventCollection = paddle.events.list();
for await (const event of eventCollection) {
    // do nothing...
}

This leads to the following console output (IDs redacted):

[Paddle] [LOG] [Request] GET https://sandbox-api.paddle.com/events Transaction ID: [...]
[Paddle] [LOG] [Response] GET https://sandbox-api.paddle.com/events 200 Transaction ID: [...] Request ID: [...]
[Paddle] [LOG] [Request] GET https://sandbox-api.paddle.com/events Transaction ID: [...]
[Paddle] [LOG] [Response] GET https://sandbox-api.paddle.com/events 200 Transaction ID: [...] Request ID: [...]
[Paddle] [LOG] [Request] GET https://sandbox-api.paddle.com/events Transaction ID: [...]
[Paddle] [LOG] [Response] GET https://sandbox-api.paddle.com/events 200 Transaction ID: [...] Request ID: [...]
[Paddle] [LOG] [Request] GET https://sandbox-api.paddle.com/events Transaction ID: [...]
[Paddle] [LOG] [Response] GET https://sandbox-api.paddle.com/events 200 Transaction ID: [...] Request ID: [...]
[Paddle] [LOG] [Request] GET https://sandbox-api.paddle.com/events Transaction ID: [...]
[Paddle] [LOG] [Response] GET https://sandbox-api.paddle.com/events 200 Transaction ID: [...] Request ID: [...]

I do not expect other libraries to pollute stdout this much. At least when nothing goes wrong, there should be no output to console by default.

I found no way to disable it, as there is no condition to disable it in the logger class.

What problem are you looking to solve?

It would make sense to disable the console.log calls by default. Instead, some logLevel setting could be provided. Example:

const paddle = new Paddle('...', {
    logLevel: 'verbose' // in this case, the current output would be fine
});

Additional context

No response

How important is this suggestion to you?

Nice to have

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions