@@ -139,29 +139,38 @@ class Logger {
139139 }
140140
141141 checkLevel ( l ) {
142- return npmlog . levels [ npmlog . level ] > l ;
142+ if ( typeof l === 'string' ) {
143+ l = CUSTOM_LEVEL [ l ] && CUSTOM_LEVEL [ l ] . level || 0 ;
144+ }
145+ return this . npmlog . levels [ this . npmlog . level ] > l ;
143146 }
144147
145148 debug ( ) {
149+ if ( this . checkLevel ( 'verbose' ) ) return ;
146150 return this . getMethod ( 'verbose' ) ( ...arguments ) ;
147151 }
148152 warn ( ) {
153+ if ( this . checkLevel ( 'warn' ) ) return ;
149154 return this . getMethod ( 'warn' ) ( ...arguments ) ;
150155 }
151156 error ( ) {
157+ if ( this . checkLevel ( 'error' ) ) return ;
152158 return this . getMethod ( 'error' ) ( ...arguments ) ;
153159 }
154160 info ( ) {
161+ if ( this . checkLevel ( 'info' ) ) return ;
155162 return this . getMethod ( 'info' ) ( ...arguments ) ;
156163 }
157164 success ( ) {
165+ if ( this . checkLevel ( 'success' ) ) return ;
158166 return this . getMethod ( 'success' ) ( ...arguments ) ;
159167 }
160168 json ( ) {
161- if ( this . checkLevel ( 3500 ) ) return ;
169+ if ( this . checkLevel ( 'notice' ) ) return ;
162170 return this . getMethod ( 'json' ) ( ...arguments ) ;
163171 }
164- logo ( ) { // 不会禁用
172+ logo ( ) { // 基本不会禁用, 10000
173+ if ( this . checkLevel ( 'noise' ) ) return ;
165174 return this . getMethod ( 'logo' ) ( ...arguments ) ;
166175 }
167176
@@ -255,9 +264,9 @@ class Logger {
255264 return this . aliasMap . get ( type ) ;
256265 }
257266
258- newGroup ( name , ... args ) {
259- const newLog = this . npmlog . newGroup ( name , ... args ) ;
260- return factroy ( newLog , { alias : this . aliasMap } ) ;
267+ newGroup ( ) {
268+ // 弃用,兼容老版本
269+ return this ;
261270 }
262271}
263272
0 commit comments