PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` import util from 'util' import { parseStack } from '../utils/error' import { writeStream } from '../utils/stream' import { formatDate } from '../utils/date' const DEFAULTS = { dateFormat: 'HH:mm:ss', formatOptions: { date: true, colors: false, compact: true } } const bracket = x => x ? `[${x}]` : '' export default class BasicReporter { constructor (options) { this.options = Object.assign({}, DEFAULTS, options) } formatStack (stack) { return ' ' + parseStack(stack).join('\n ') } formatArgs (args) { const _args = args.map(arg => { if (arg && typeof arg.stack === 'string') { return arg.message + '\n' + this.formatStack(arg.stack) } return arg }) // Only supported with Node >= 10 // https://nodejs.org/api/util.html#util_util_inspect_object_options if (typeof util.formatWithOptions === 'function') { return util.formatWithOptions(this.options.formatOptions, ..._args) } else { return util.format(..._args) } } formatDate (date) { return this.options.formatOptions.date ? formatDate(this.options.dateFormat, date) : '' } filterAndJoin (arr) { return arr.filter(x => x).join(' ') } formatLogObj (logObj) { const message = this.formatArgs(logObj.args) return this.filterAndJoin([ bracket(logObj.type), bracket(logObj.tag), message ]) } log (logObj, { async, stdout, stderr } = {}) { const line = this.formatLogObj(logObj, { width: stdout.columns || 0 }) return writeStream( line + '\n', logObj.level < 2 ? stderr : stdout, async ? 'async' : 'default' ) } }