@@ -412,6 +412,10 @@ export class SevLogger {
412412 this . reset ( params )
413413 }
414414
415+ #inspect( value : unknown ) : string {
416+ return inspect ( value , false , null , process . env . NO_COLOR !== '1' && ! this . filepath )
417+ }
418+
415419 colorByName ( name : string ) {
416420 const absCrc = SevLogger . #crc32( name )
417421
@@ -923,7 +927,7 @@ export class SevLogger {
923927 const base = workingMessages . shift ( )
924928 if ( typeof base !== 'string' ) {
925929 // Should not happen due to initial check, but safeguard
926- subject = inspect ( base , false , null , true )
930+ subject = this . # inspect( base )
927931 } else {
928932 // Perform replacement - Type errors inside callback WILL throw
929933 subject = base . replace (
@@ -947,7 +951,7 @@ export class SevLogger {
947951 if ( typeof arg === 'string' || typeof arg === 'number' ) {
948952 return match . replace ( '%s' , fmtColorFunc ( String ( arg ) ) )
949953 }
950- return match . replace ( '%s' , inspect ( arg , false , null , true ) ) // Use inspect for non-string/num %s
954+ return match . replace ( '%s' , this . # inspect( arg ) ) // Use inspect for non-string/num %s
951955 }
952956 if ( match . includes ( '%r' ) ) {
953957 if ( typeof arg !== 'string' ) {
@@ -982,15 +986,15 @@ export class SevLogger {
982986 console . error ( `SevLogger Formatting Warning: ${ errorMsg } ` , originalMessages )
983987 // Fallback: Use original messages inspected
984988 subject = originalMessages
985- . map ( ( msg ) => ( typeof msg === 'string' ? msg : inspect ( msg , false , null , true ) ) )
989+ . map ( ( msg ) => ( typeof msg === 'string' ? msg : this . # inspect( msg ) ) )
986990 . join ( ' ' )
987991 subject = subject . replace ( / % % / g, '%' ) // Still handle escapes in the fallback
988992 }
989993 }
990994 } else {
991995 // No format specifiers or mismatch count, inspect all messages
992996 subject = redactedMessages
993- . map ( ( msg ) => ( typeof msg === 'string' ? msg : inspect ( msg , false , null , true ) ) )
997+ . map ( ( msg ) => ( typeof msg === 'string' ? msg : this . # inspect( msg ) ) )
994998 . join ( ' ' )
995999 subject = subject . replace ( / % % / g, '%' )
9961000 }
0 commit comments