UNPKG

550 BJavaScriptView Raw
1'use strict'
2
3const { gray, red } = require('./detect/colors')
4const logCommon = require('./logCommon')
5
6module.exports = (event, verbose = false) => {
7 const reason = event.reason
8 if (event.method && event.url) {
9 const details = []
10 if (verbose) {
11 details.push(red(reason.toString()))
12 } else {
13 details.push(red('\n\\____'), gray(reason.toString()))
14 }
15 logCommon.call(event, 'ERROR', verbose, ...details)
16 } else {
17 logCommon.call({ ...event, method: '', url: '' }, 'ERROR', false, gray(reason.toString()))
18 }
19}