Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored Apr 16, 2024
1 parent b22d5ee commit 141aa6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions lib/log.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use strict'

const procLog = require('proc-log')
const { log } = require('proc-log')
const { format } = require('util')

// helper to emit log messages with a predefined prefix
const logLevels = Object.keys(procLog).filter((k) => typeof procLog[k] === 'function')
const withPrefix = (prefix) => logLevels.reduce((acc, level) => {
acc[level] = (...args) => procLog[level](prefix, ...args)
const withPrefix = (prefix) => log.LEVELS.reduce((acc, level) => {
acc[level] = (...args) => log[level](prefix, ...args)
return acc
}, {})

Expand Down Expand Up @@ -78,7 +77,7 @@ class Logger {
this.#levels = new Map(this.#levels.map((level, index) => [level.id, { ...level, index }]))
this.level = 'info'
this.stream = stream
procLog.pause()
log.pause()
}

get stream () {
Expand Down Expand Up @@ -165,5 +164,5 @@ module.exports = {
logger: new Logger(NULL_LOGGER ? null : process.stderr),
stdout: NULL_LOGGER ? () => {} : (...args) => console.log(...args),
withPrefix,
...procLog
...log
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"graceful-fs": "^4.2.6",
"make-fetch-happen": "^13.0.0",
"nopt": "^7.0.0",
"proc-log": "^3.0.0",
"proc-log": "^4.1.0",
"semver": "^7.3.5",
"tar": "^6.2.1",
"which": "^4.0.0"
Expand Down

0 comments on commit 141aa6b

Please sign in to comment.