utils.js 322 B

1234567891011121314
  1. 'use strict';
  2. const chalk = require('chalk');
  3. const format = require('date-fns/format');
  4. exports.log = (options, output) => {
  5. if (options.dateFormat === false) {
  6. console.log(output);
  7. return;
  8. }
  9. const timestamp = format(new Date(), options.dateFormat);
  10. console.log(chalk.dim(`[${timestamp}]`) + ` ${output}`);
  11. };