Skip to content

Commit

Permalink
improve-logger (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
maidh91 authored Nov 7, 2024
1 parent 13758e4 commit 23e98b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { isBare, isWindows } = require('which-runtime')
const hrtime = isBare ? require('bare-hrtime') : process.hrtime

class Logger {
constructor ({ labels, fields = '', stacks = false, level = 1, pretty = false } = {}) {
constructor ({ labels, fields = '', stacks = false, level, pretty = false } = {}) {
fields = this._parseFields(fields)
this._labels = new Set(this._parseLabels(labels))
this._labels.add('internal')
Expand Down Expand Up @@ -93,7 +93,7 @@ class Logger {
}

_parseLevel (level) {
if (typeof level !== 'string') return level
if (typeof level === 'number') return level
level = level.toUpperCase()
if (level === 'OFF' || level === '0') return 0
if (level === 'ERR' || level === 'ERROR' || level === '1') return 1
Expand Down

0 comments on commit 23e98b5

Please sign in to comment.