Skip to content

Commit

Permalink
fix uncolored output
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Jul 29, 2024
1 parent 009a254 commit 9fd852b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions logging.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ export const computeNoColorLoggingArgs = args => {
if (args.length === 1 && args[0]?.constructor === Function) {
args = /** @type {Array<string|Symbol|Object|number>} */ (/** @type {[function]} */ (args)[0]())
}
const strBuilder = []
const logArgs = []
// try with formatting until we find something unsupported
let i = 0
for (; i < args.length; i++) {
const arg = args[i]
if (arg === undefined) {
strBuilder.push('undefined')
logArgs.push('undefined')
} else if (arg.constructor === String || arg.constructor === Number) {
strBuilder.push(arg)
logArgs.push(arg)
} else if (arg.constructor === Object) {
logArgs.push(JSON.stringify(arg))
}
Expand Down

0 comments on commit 9fd852b

Please sign in to comment.