@@ -273,7 +273,7 @@ ObjectDefineProperties(Console.prototype, {
273273 [ kWriteToConsole ] : {
274274 __proto__ : null ,
275275 ...consolePropAttributes ,
276- value : function ( streamSymbol , string ) {
276+ value : function ( streamSymbol , string , color ) {
277277 const ignoreErrors = this . _ignoreErrors ;
278278 const groupIndent = this [ kGroupIndent ] ;
279279
@@ -288,6 +288,11 @@ ObjectDefineProperties(Console.prototype, {
288288 }
289289 string = groupIndent + string ;
290290 }
291+
292+ if ( color && lazyUtilColors ( ) . hasColors ) {
293+ string = `${ color } ${ string } ${ lazyUtilColors ( ) . clear } ` ;
294+ }
295+
291296 string += '\n' ;
292297
293298 if ( ignoreErrors === false ) return stream . write ( string ) ;
@@ -381,9 +386,12 @@ const consoleMethods = {
381386
382387
383388 warn ( ...args ) {
384- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) ) ;
389+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , lazyUtilColors ( ) . yellow ) ;
385390 } ,
386391
392+ error ( ...args ) {
393+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , lazyUtilColors ( ) . red ) ;
394+ } ,
387395
388396 dir ( object , options ) {
389397 this [ kWriteToConsole ] ( kUseStdout , inspect ( object , {
@@ -689,7 +697,6 @@ for (const method of ReflectOwnKeys(consoleMethods))
689697Console . prototype . debug = Console . prototype . log ;
690698Console . prototype . info = Console . prototype . log ;
691699Console . prototype . dirxml = Console . prototype . log ;
692- Console . prototype . error = Console . prototype . warn ;
693700Console . prototype . groupCollapsed = Console . prototype . group ;
694701
695702function initializeGlobalConsole ( globalConsole ) {
0 commit comments