Skip to content

Commit

Permalink
Pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonEtco committed Dec 3, 2018
1 parent 5860cec commit 4ce70fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Expand Up @@ -120,15 +120,18 @@ module.exports = function prettyFactory (options) {
log.time = formatTime(log.time, opts.translateTime)
}

var line = `[${log.time}]`
var line = log.time ? `[${log.time}]` : ''

const coloredLevel = levels.hasOwnProperty(log.level)
? color[log.level](levels[log.level])
: color.default(levels.default)
if (opts.levelFirst) {
line = `${coloredLevel} ${line}`
} else {
line = `${line} ${coloredLevel}`
// If the line is not empty (timestamps are enabled) output it
// with a space after it - otherwise output the empty string
const lineOrEmpty = line && line + ' '
line = `${lineOrEmpty}${coloredLevel}`
}

if (log.name || log.pid || log.hostname) {
Expand Down

0 comments on commit 4ce70fa

Please sign in to comment.