Skip to content

Commit

Permalink
Fix xo
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGriffiths committed Feb 15, 2019
1 parent 17bd238 commit dbd2940
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/lib/verbosity.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export default class Verbosity extends Console {
}
}
}

/**
* Set the current verbosity.
* @param {Number} level - The current level (0 to 5).
Expand All @@ -182,6 +183,7 @@ export default class Verbosity extends Console {
if (level < 6) {
this.threshold = level
}

return this.threshold
}

Expand All @@ -204,11 +206,12 @@ export default class Verbosity extends Console {
*/
route(level, msg, ...a) {
msg = (a.length > 0) ? format(msg, ...a) : msg
if (willEmit) {
if (this.willEmit) {
this.emitter.emit(level, msg)
}

if (this.threshold >= this.matrix[level].level) {
const pfix = `${timeFormatter()}${prefixFormatter()}`
const pfix = `${this.timeFormatter()}${this.prefixFormatter()}`
this.matrix[level].stream.write(`${this.matrix[level].format(pfix, msg)}\n`)
}
}
Expand Down Expand Up @@ -294,7 +297,7 @@ export default class Verbosity extends Console {
const {depth = 0, colors = termNG.color.basic} = options
options.depth = depth
options.colors = colors
sOut.write(format(inspect(obj, options)))
this._stdout.write(format(inspect(obj, options)))
}

/**
Expand All @@ -317,7 +320,7 @@ export default class Verbosity extends Console {
* ...
*/
pretty(obj, depth = 0, color = true) {
sOut.write(format('Content: %s\n', inspect(obj, {
this._stdout.write(format('Content: %s\n', inspect(obj, {
depth,
colors: color && termNG.color.basic
})
Expand Down Expand Up @@ -350,13 +353,15 @@ export default class Verbosity extends Console {
*/
yargs(obj, color = true) {
const parsed = {}

Object.keys(obj).forEach(key_ => {
const val = obj[key_]
switch (key_) {
case '_':
if (val.length > 0) {
parsed.arguments = val.join(' ')
}

break
case '$0':
parsed.self = val
Expand All @@ -367,7 +372,7 @@ export default class Verbosity extends Console {
}
}
})
sOut.write(format('Options (yargs):\n %s\n', inspect(parsed, {
this._stdout.write(format('Options (yargs):\n %s\n', inspect(parsed, {
colors: color && termNG.color.basic
})
.slice(2, -1)
Expand Down

0 comments on commit dbd2940

Please sign in to comment.