88 ArrayIsArray,
99 ArrayPrototypeForEach,
1010 ArrayPrototypePush,
11- ArrayPrototypeSome,
1211 ArrayPrototypeUnshift,
1312 Boolean,
1413 ErrorCaptureStackTrace,
@@ -68,7 +67,6 @@ const {
6867 CHAR_LOWERCASE_N : kTraceInstant ,
6968 CHAR_UPPERCASE_C : kTraceCount ,
7069} = require ( 'internal/constants' ) ;
71- const { styleText } = require ( 'util' ) ;
7270const kCounts = Symbol ( 'counts' ) ;
7371
7472const kTraceConsoleCategory = 'node,node.console' ;
@@ -274,7 +272,7 @@ ObjectDefineProperties(Console.prototype, {
274272 [ kWriteToConsole ] : {
275273 __proto__ : null ,
276274 ...consolePropAttributes ,
277- value : function ( streamSymbol , string , color = '' ) {
275+ value : function ( streamSymbol , string ) {
278276 const ignoreErrors = this . _ignoreErrors ;
279277 const groupIndent = this [ kGroupIndent ] ;
280278
@@ -289,11 +287,6 @@ ObjectDefineProperties(Console.prototype, {
289287 }
290288 string = groupIndent + string ;
291289 }
292-
293- if ( color ) {
294- string = styleText ( color , string ) ;
295- }
296-
297290 string += '\n' ;
298291
299292 if ( ignoreErrors === false ) return stream . write ( string ) ;
@@ -384,15 +377,12 @@ const consoleMethods = {
384377 log ( ...args ) {
385378 this [ kWriteToConsole ] ( kUseStdout , this [ kFormatForStdout ] ( args ) ) ;
386379 } ,
380+
381+
387382 warn ( ...args ) {
388- const color = ( shouldColorize ( args ) && 'yellow' ) || '' ;
389- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , color ) ;
383+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) ) ;
390384 } ,
391385
392- error ( ...args ) {
393- const color = ( shouldColorize ( args ) && 'red' ) || '' ;
394- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , color ) ;
395- } ,
396386
397387 dir ( object , options ) {
398388 this [ kWriteToConsole ] ( kUseStdout , inspect ( object , {
@@ -685,12 +675,6 @@ const iterKey = '(iteration index)';
685675
686676const isArray = ( v ) => ArrayIsArray ( v ) || isTypedArray ( v ) || isBuffer ( v ) ;
687677
688- // TODO: remove string type check once the styleText supports objects
689- // Return true if all args are type string
690- const shouldColorize = ( args ) => {
691- return lazyUtilColors ( ) . hasColors && ! ArrayPrototypeSome ( args , ( arg ) => typeof arg !== 'string' ) ;
692- } ;
693-
694678function noop ( ) { }
695679
696680for ( const method of ReflectOwnKeys ( consoleMethods ) )
@@ -699,6 +683,7 @@ for (const method of ReflectOwnKeys(consoleMethods))
699683Console . prototype . debug = Console . prototype . log ;
700684Console . prototype . info = Console . prototype . log ;
701685Console . prototype . dirxml = Console . prototype . log ;
686+ Console . prototype . error = Console . prototype . warn ;
702687Console . prototype . groupCollapsed = Console . prototype . group ;
703688
704689function initializeGlobalConsole ( globalConsole ) {
0 commit comments