Created
December 8, 2012 00:03
-
-
Save krisives/4237686 to your computer and use it in GitHub Desktop.
Clean Verbose PHP Logs when buried in layers of CGI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// Remove lots of crap from logs easily | |
while (($line = fgets(STDIN)) !== false) { | |
$line = trim($line); | |
$line = preg_replace('#^\[[^\]]+\] \[[^\]]+\] \[[^\]]+\] [^\:]+\: [^\:]+\:#i', '', $line); | |
$line = trim($line); | |
if (strlen($line) <= 0) { | |
continue; | |
} | |
echo $line, "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment