Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Improve 'setupLogging' to instantiate a log array if none is provided #244

Merged
merged 4 commits into from
Nov 8, 2023

Conversation

Brad-Turner
Copy link
Contributor

@Brad-Turner Brad-Turner commented Nov 1, 2023

Summary

  • Modifies the log parameter to be optional.
  • Returns the log value (whether passed-in or instantiated)

Usage in contentful-export:

  const log = []
  const options = parseOptions(params)

  const listrOptions = createListrOptions(options)

  // Setup custom error listener to store errors for later
  setupLogging(log)

New behaviour:

  // Setup custom error listener to store errors for later
  const log = setupLogging()
  const options = parseOptions(params)

  const listrOptions = createListrOptions(options)

Usage in contentful-import:

  const log = []
  const options = parseOptions(params)
  const listrOptions = createListrOptions(options)
  const requestQueue = new PQueue({
    interval: ONE_SECOND,
    intervalCap: options.rateLimit,
    carryoverConcurrencyCount: true
  })

  // Setup custom log listener to store log messages for later
  setupLogging(log)

New behaviour:

  // Setup custom log listener to store log messages for later
  const log = setupLogging()
  const options = parseOptions(params)
  const listrOptions = createListrOptions(options)
  const requestQueue = new PQueue({
    interval: ONE_SECOND,
    intervalCap: options.rateLimit,
    carryoverConcurrencyCount: true
  })

@Brad-Turner Brad-Turner marked this pull request as ready for review November 1, 2023 11:40
@Brad-Turner Brad-Turner requested a review from a team as a code owner November 1, 2023 11:40
Copy link
Member

@mayakarabula mayakarabula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good :)

@marcolink marcolink merged commit d90896d into contentful:master Nov 8, 2023
2 checks passed
@contentful-automation
Copy link

🎉 This PR is included in version 10.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants