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.
if ( $wgDebugLogFile != '' && !$wgProfileOnly ) {
# Strip unprintables; they can switch terminal modes when binary data
# gets dumped, which is pretty annoying.
- $text = preg_replace( '![\x00-\x08\x0b\x0c\x0e-\x1f]!', ' ', $text );
+ $text = preg_replace( '![\x00-\x08\x0b\x0c\x0e-\x1a\x1c-\x1f]!', ' ', $text );
$text = $wgDebugLogPrefix . $text;
wfErrorLog( $text, $wgDebugLogFile );
}