@@ -273,7 +273,7 @@ ObjectDefineProperties(Console.prototype, {
273
273
[ kWriteToConsole ] : {
274
274
__proto__ : null ,
275
275
...consolePropAttributes ,
276
- value : function ( streamSymbol , string ) {
276
+ value : function ( streamSymbol , string , color ) {
277
277
const ignoreErrors = this . _ignoreErrors ;
278
278
const groupIndent = this [ kGroupIndent ] ;
279
279
@@ -288,6 +288,11 @@ ObjectDefineProperties(Console.prototype, {
288
288
}
289
289
string = groupIndent + string ;
290
290
}
291
+
292
+ if ( color && lazyUtilColors ( ) . hasColors ) {
293
+ string = `${ color } ${ string } ` ;
294
+ }
295
+
291
296
string += '\n' ;
292
297
293
298
if ( ignoreErrors === false ) return stream . write ( string ) ;
@@ -381,9 +386,12 @@ const consoleMethods = {
381
386
382
387
383
388
warn ( ...args ) {
384
- this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) ) ;
389
+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , lazyUtilColors ( ) . yellow ) ;
385
390
} ,
386
391
392
+ error ( ...args ) {
393
+ this [ kWriteToConsole ] ( kUseStderr , this [ kFormatForStderr ] ( args ) , lazyUtilColors ( ) . red ) ;
394
+ } ,
387
395
388
396
dir ( object , options ) {
389
397
this [ kWriteToConsole ] ( kUseStdout , inspect ( object , {
@@ -689,7 +697,6 @@ for (const method of ReflectOwnKeys(consoleMethods))
689
697
Console . prototype . debug = Console . prototype . log ;
690
698
Console . prototype . info = Console . prototype . log ;
691
699
Console . prototype . dirxml = Console . prototype . log ;
692
- Console . prototype . error = Console . prototype . warn ;
693
700
Console . prototype . groupCollapsed = Console . prototype . group ;
694
701
695
702
function initializeGlobalConsole ( globalConsole ) {
0 commit comments