Skip to content

Instantly share code, notes, and snippets.

@krisives
Created December 8, 2012 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisives/4237686 to your computer and use it in GitHub Desktop.
Save krisives/4237686 to your computer and use it in GitHub Desktop.
Clean Verbose PHP Logs when buried in layers of CGI
<?
// 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