1ee9fdbeae06efebb9149ccf45008051e0d875f7e956e4e36c6aad7e24c7201c4337346761cb10e2af053e1037fd76814a819039fd1f9c8d3e08b42cdb4f49 430 B

12345678910111213141516
  1. 'use strict'
  2. /**
  3. * Handle logging of listr `ctx.output` to the specified `logger`
  4. * @param {Object} ctx - The listr initial state
  5. * @param {Object} logger - The logger
  6. */
  7. const printTaskOutput = (ctx = {}, logger) => {
  8. if (!Array.isArray(ctx.output)) return
  9. const log = ctx.errors && ctx.errors.size > 0 ? logger.error : logger.log
  10. for (const line of ctx.output) {
  11. log(line)
  12. }
  13. }
  14. module.exports = printTaskOutput