src/commands/logs.js
/**
   * Print logs that have been queueing
   */
Print logs that have been queueing
Print logs that have been queueing
printLogs() {
    const unprinted = this.logs.findIndex(log => !log.printed)
    if (unprinted < 0) {
      return
    }
    const {flags: {utc}} = this.parse(LogsCommand)
    const updated = this.logs.slice(unprinted)
    updated.forEach(log => {
      this.log(log.formattedSummary(utc))
      log.setPrinted()
    })
    this.logs.splice(unprinted, updated.length, ...updated)
    this.printLogs()
  }
printLogs ( ) { const unprinted = this . logs . findIndex ( log => ! log . printed ) if ( unprinted < 0 ) { return } const { flags : { utc } } = this . parse ( LogsCommand ) const updated = this . logs . slice ( unprinted ) updated . forEach ( log => { this . log ( log . formattedSummary ( utc ) ) log . setPrinted ( ) } ) this . logs . splice ( unprinted , updated . length , ... updated ) this . printLogs ( ) }
Print logs that have been queueing
Print logs that have been queueing
// Find the first index of an unprinted log // Bail if there's nothing to print // Fetch the UTC preference from command flags // Slice just those logs and print them // Splice in the logs that have been printed // Recurse until logs are printed. It's slightly possible that logs might come in while catching up