88 ArrayIsArray,
99 ArrayPrototypeForEach,
1010 ArrayPrototypePush,
11- ArrayPrototypeSome,
1211 ArrayPrototypeUnshift,
1312 Boolean,
1413 ErrorCaptureStackTrace,
@@ -60,7 +59,6 @@ const {
6059const {
6160 CHAR_UPPERCASE_C : kTraceCount ,
6261} = require ( 'internal/constants' ) ;
63- const { styleText } = require ( 'util' ) ;
6462const kCounts = Symbol ( 'counts' ) ;
6563const { time, timeLog, timeEnd, kNone } = require ( 'internal/util/debuglog' ) ;
6664
@@ -264,7 +262,7 @@ ObjectDefineProperties(Console.prototype, {
264262 [ kWriteToConsole ] : {
265263 __proto__ : null ,
266264 ...consolePropAttributes ,
267- value : function ( streamSymbol , string , color = '' ) {
265+ value : function ( streamSymbol , string ) {
268266 const ignoreErrors = this . _ignoreErrors ;
269267 const groupIndent = internalIndentationMap . get ( this ) || '' ;
270268
@@ -279,11 +277,6 @@ ObjectDefineProperties(Console.prototype, {
279277 }
280278 string = groupIndent + string ;
281279 }
282-
283- if ( color ) {
284- string = styleText ( color , string ) ;
285- }
286-
287280 string += '\n' ;
288281
289282 if ( ignoreErrors === false ) return stream . write ( string ) ;
@@ -382,15 +375,12 @@ const consoleMethods = {
382375 log ( ...args ) {
383376 this [ kWriteToConsole ] ( kUseStdout , this [ kFormatForStdout ] ( args ) ) ;
384377 } ,
378+
379+
385380 warn ( ...args ) {
386- const color = ( shouldColorize ( args ) && 'yellow' ) || '' ;
387- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , color ) ;
381+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) ) ;
388382 } ,
389383
390- error ( ...args ) {
391- const color = ( shouldColorize ( args ) && 'red' ) || '' ;
392- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , color ) ;
393- } ,
394384
395385 dir ( object , options ) {
396386 this [ kWriteToConsole ] ( kUseStdout , inspect ( object , {
@@ -621,12 +611,6 @@ const iterKey = '(iteration index)';
621611
622612const isArray = ( v ) => ArrayIsArray ( v ) || isTypedArray ( v ) || isBuffer ( v ) ;
623613
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-
630614function noop ( ) { }
631615
632616for ( const method of ReflectOwnKeys ( consoleMethods ) )
@@ -635,6 +619,7 @@ for (const method of ReflectOwnKeys(consoleMethods))
635619Console . prototype . debug = Console . prototype . log ;
636620Console . prototype . info = Console . prototype . log ;
637621Console . prototype . dirxml = Console . prototype . log ;
622+ Console . prototype . error = Console . prototype . warn ;
638623Console . prototype . groupCollapsed = Console . prototype . group ;
639624
640625function initializeGlobalConsole ( globalConsole ) {
0 commit comments