Skip to content

Commit

Permalink
Replace use of npmlog dependency with console.error (#182)
Browse files Browse the repository at this point in the history
No change to log message format or level
  • Loading branch information
lovell committed Jun 7, 2022
1 parent d1853cb commit 4e2284c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
34 changes: 27 additions & 7 deletions log.js
@@ -1,13 +1,33 @@
const log = require('npmlog')
const levels = {
silent: 0,
error: 1,
warn: 2,
notice: 3,
http: 4,
timing: 5,
info: 6,
verbose: 7,
silly: 8
}

module.exports = function (rc, env) {
log.heading = 'prebuild-install'
const level = rc.verbose
? 'verbose'
: env.npm_config_loglevel || 'notice'

if (rc.verbose) {
log.level = 'verbose'
} else {
log.level = env.npm_config_loglevel || 'notice'
const logAtLevel = function (messageLevel) {
return function (...args) {
if (levels[messageLevel] <= levels[level]) {
console.error(`prebuild-install ${messageLevel} ${args.join(' ')}`)
}
}
}

return log
return {
error: logAtLevel('error'),
warn: logAtLevel('warn'),
http: logAtLevel('http'),
info: logAtLevel('info'),
level
}
}
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -26,7 +26,6 @@
"mkdirp-classic": "^0.5.3",
"napi-build-utils": "^1.0.1",
"node-abi": "^3.3.0",
"npmlog": "^4.0.1",
"pump": "^3.0.0",
"rc": "^1.2.7",
"simple-get": "^4.0.0",
Expand Down

0 comments on commit 4e2284c

Please sign in to comment.