Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxins committed Jul 17, 2019
1 parent 3ded55e commit 225b98e
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 122 deletions.
19 changes: 10 additions & 9 deletions index.js
Expand Up @@ -45,7 +45,7 @@ function dev (opts) {
}

return function printFunc (...args) {
let str = util.format(...args)
const str = util.format(...args)
if (transporter) {
transporter(str, args)
} else {
Expand All @@ -60,8 +60,8 @@ function dev (opts) {
print(' ' + chalk.gray('<--') +
' ' + chalk.bold('%s') +
' ' + chalk.gray('%s'),
ctx.method,
ctx.originalUrl)
ctx.method,
ctx.originalUrl)

try {
await next()
Expand Down Expand Up @@ -113,6 +113,7 @@ function log (print, ctx, start, len, err, event) {

// set the color of the status code;
const s = status / 100 | 0
// eslint-disable-next-line
const color = colorCodes.hasOwnProperty(s) ? colorCodes[s] : colorCodes[0]

// get the human readable response length
Expand All @@ -127,19 +128,19 @@ function log (print, ctx, start, len, err, event) {

const upstream = err ? chalk.red('xxx')
: event === 'close' ? chalk.yellow('-x-')
: chalk.gray('-->')
: chalk.gray('-->')

print(' ' + upstream +
' ' + chalk.bold('%s') +
' ' + chalk.gray('%s') +
' ' + chalk[color]('%s') +
' ' + chalk.gray('%s') +
' ' + chalk.gray('%s'),
ctx.method,
ctx.originalUrl,
status,
time(start),
length)
ctx.method,
ctx.originalUrl,
status,
time(start),
length)
}

/**
Expand Down

0 comments on commit 225b98e

Please sign in to comment.