8
8
ArrayIsArray,
9
9
ArrayPrototypeForEach,
10
10
ArrayPrototypePush,
11
- ArrayPrototypeSome,
12
11
ArrayPrototypeUnshift,
13
12
Boolean,
14
13
ErrorCaptureStackTrace,
@@ -60,7 +59,6 @@ const {
60
59
const {
61
60
CHAR_UPPERCASE_C : kTraceCount ,
62
61
} = require ( 'internal/constants' ) ;
63
- const { styleText } = require ( 'util' ) ;
64
62
const kCounts = Symbol ( 'counts' ) ;
65
63
const { time, timeLog, timeEnd, kNone } = require ( 'internal/util/debuglog' ) ;
66
64
@@ -264,7 +262,7 @@ ObjectDefineProperties(Console.prototype, {
264
262
[ kWriteToConsole ] : {
265
263
__proto__ : null ,
266
264
...consolePropAttributes ,
267
- value : function ( streamSymbol , string , color = '' ) {
265
+ value : function ( streamSymbol , string ) {
268
266
const ignoreErrors = this . _ignoreErrors ;
269
267
const groupIndent = internalIndentationMap . get ( this ) || '' ;
270
268
@@ -279,11 +277,6 @@ ObjectDefineProperties(Console.prototype, {
279
277
}
280
278
string = groupIndent + string ;
281
279
}
282
-
283
- if ( color ) {
284
- string = styleText ( color , string ) ;
285
- }
286
-
287
280
string += '\n' ;
288
281
289
282
if ( ignoreErrors === false ) return stream . write ( string ) ;
@@ -382,15 +375,12 @@ const consoleMethods = {
382
375
log ( ...args ) {
383
376
this [ kWriteToConsole ] ( kUseStdout , this [ kFormatForStdout ] ( args ) ) ;
384
377
} ,
378
+
379
+
385
380
warn ( ...args ) {
386
- const color = ( shouldColorize ( args ) && 'yellow' ) || '' ;
387
- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , color ) ;
381
+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) ) ;
388
382
} ,
389
383
390
- error ( ...args ) {
391
- const color = ( shouldColorize ( args ) && 'red' ) || '' ;
392
- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , color ) ;
393
- } ,
394
384
395
385
dir ( object , options ) {
396
386
this [ kWriteToConsole ] ( kUseStdout , inspect ( object , {
@@ -621,12 +611,6 @@ const iterKey = '(iteration index)';
621
611
622
612
const isArray = ( v ) => ArrayIsArray ( v ) || isTypedArray ( v ) || isBuffer ( v ) ;
623
613
624
- // TODO: remove string type check once the styleText supports objects
625
- // Return true if all args are type string
626
- const shouldColorize = ( args ) => {
627
- return lazyUtilColors ( ) . hasColors && ! ArrayPrototypeSome ( args , ( arg ) => typeof arg !== 'string' ) ;
628
- } ;
629
-
630
614
function noop ( ) { }
631
615
632
616
for ( const method of ReflectOwnKeys ( consoleMethods ) )
@@ -635,6 +619,7 @@ for (const method of ReflectOwnKeys(consoleMethods))
635
619
Console . prototype . debug = Console . prototype . log ;
636
620
Console . prototype . info = Console . prototype . log ;
637
621
Console . prototype . dirxml = Console . prototype . log ;
622
+ Console . prototype . error = Console . prototype . warn ;
638
623
Console . prototype . groupCollapsed = Console . prototype . group ;
639
624
640
625
function initializeGlobalConsole ( globalConsole ) {
0 commit comments