r102504 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102503‎ | r102504 | r102505 >
Date:10:24, 9 November 2011
Author:hashar
Status:reverted (Comments)
Tags:
Comment:
Allow \x1b (ascii ESC) in wfDebug() output

It is a local hack I had to let me pass colored debug message using a local
wrapper:

function wfDebugGreen($msg) {
$color = "\x1b[1;32m"; # Green
$reset = "\x1b[1;0m";
wfDebug( $color . $msg . $reset );
}

Ideally \x1b should only be kept if it is followed by /(\d+(;\d)?)?+m/
which should match the 'graphic rendering' ANSI escape code.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -710,7 +710,7 @@
711711 if ( $wgDebugLogFile != '' && !$wgProfileOnly ) {
712712 # Strip unprintables; they can switch terminal modes when binary data
713713 # gets dumped, which is pretty annoying.
714 - $text = preg_replace( '![\x00-\x08\x0b\x0c\x0e-\x1f]!', ' ', $text );
 714+ $text = preg_replace( '![\x00-\x08\x0b\x0c\x0e-\x1a\x1c-\x1f]!', ' ', $text );
715715 $text = $wgDebugLogPrefix . $text;
716716 wfErrorLog( $text, $wgDebugLogFile );
717717 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r105655Revert r102504 (allow ESC in debug output): the justification in the comment ...tstarling06:03, 9 December 2011

Comments

#Comment by MaxSem (talk | contribs)   14:46, 9 November 2011

Whaaaaa? Windows-phobia again? ;P

Status & tagging log