Commit 4e2284c 1 parent d1853cb commit 4e2284c Copy full SHA for 4e2284c
File tree 2 files changed +27
-8
lines changed
2 files changed +27
-8
lines changed Original file line number Diff line number Diff line change 1
- const log = require ( 'npmlog' )
1
+ const levels = {
2
+ silent : 0 ,
3
+ error : 1 ,
4
+ warn : 2 ,
5
+ notice : 3 ,
6
+ http : 4 ,
7
+ timing : 5 ,
8
+ info : 6 ,
9
+ verbose : 7 ,
10
+ silly : 8
11
+ }
2
12
3
13
module . exports = function ( rc , env ) {
4
- log . heading = 'prebuild-install'
14
+ const level = rc . verbose
15
+ ? 'verbose'
16
+ : env . npm_config_loglevel || 'notice'
5
17
6
- if ( rc . verbose ) {
7
- log . level = 'verbose'
8
- } else {
9
- log . level = env . npm_config_loglevel || 'notice'
18
+ const logAtLevel = function ( messageLevel ) {
19
+ return function ( ...args ) {
20
+ if ( levels [ messageLevel ] <= levels [ level ] ) {
21
+ console . error ( `prebuild-install ${ messageLevel } ${ args . join ( ' ' ) } ` )
22
+ }
23
+ }
10
24
}
11
25
12
- return log
26
+ return {
27
+ error : logAtLevel ( 'error' ) ,
28
+ warn : logAtLevel ( 'warn' ) ,
29
+ http : logAtLevel ( 'http' ) ,
30
+ info : logAtLevel ( 'info' ) ,
31
+ level
32
+ }
13
33
}
Original file line number Diff line number Diff line change 26
26
"mkdirp-classic" : " ^0.5.3" ,
27
27
"napi-build-utils" : " ^1.0.1" ,
28
28
"node-abi" : " ^3.3.0" ,
29
- "npmlog" : " ^4.0.1" ,
30
29
"pump" : " ^3.0.0" ,
31
30
"rc" : " ^1.2.7" ,
32
31
"simple-get" : " ^4.0.0" ,
You can’t perform that action at this time.
0 commit comments