|
| 1 | +#!/usr/bin/perl |
| 2 | +# |
| 3 | +# This script is filtering out log messages from htmlunit. |
| 4 | +# It's a workaround for https://github.com/php-coder/mystamps/issues/538 |
| 5 | +# |
| 6 | + |
| 7 | +use strict; |
| 8 | +use warnings; |
| 9 | + |
| 10 | +my @regexps = ( |
| 11 | + # [WARNING] CSS error: 'http://127.0.0.1:8081/public/bootstrap/3.3.7/css/bootstrap.min.css' [5:56298] Error in expression; ':' found after identifier "progid". |
| 12 | + qr/\[WARNING\] CSS error: '[^']+' \[[^]]+\] Error in expression; [^\.]+\.\n/, |
| 13 | + |
| 14 | + # [WARNING] CSS error: 'http://127.0.0.1:8081/public/bootstrap/3.3.7/css/bootstrap.min.css' [5:115558] Invalid color "#000\9". |
| 15 | + qr/\[WARNING\] CSS error: '[^']+' \[[^]]+\] Invalid color "[^"]+"\.\n/, |
| 16 | + |
| 17 | + # [WARNING] CSS error: 'http://127.0.0.1:8081/public/selectize/0.12.3/css/selectize.bootstrap3.css' [176:3] Error in declaration. '*' is not allowed as first char of a property. |
| 18 | + qr/\[WARNING\] CSS error: '[^']+' \[[^]]+\] Error in declaration\. '\*' is not allowed as first char of a property\.\n/, |
| 19 | + |
| 20 | + # [ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://127.0.0.1:8081/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0] |
| 21 | + qr/\[ERROR\] runtimeError: message=\[[^]]+\] sourceName=\[[^]]+\] line=\[[^]]+\] lineSource=\[[^]]+\] lineOffset=\[[^]]+\]\n/, |
| 22 | + |
| 23 | + # [ERROR] runtimeError: message=[An invalid or illegal selector was specified (selector: '[id='sizzle-1487943406281'] [data-selectable]:first' error: Invalid selector: [id="sizzle-1487943406281"] [data-selectable]:first).] sourceName=[http://127.0.0.1:8081/public/jquery/1.9.1/jquery.min.js] line=[4] lineSource=[null] lineOffset=[0] |
| 24 | + qr/\[ERROR\] runtimeError: message=\[[^\(]+\(selector: '\[id='sizzle-[^']+'\] \[data-selectable\]:first' error: Invalid selector: \[id="sizzle-[^"]+"\] \[data-selectable\]:first\)\.\] sourceName=\[[^]]+\] line=\[[^]]+\] lineSource=\[[^]]+\] lineOffset=\[[^]]+\]\n/, |
| 25 | + |
| 26 | + # [INFO] Bad input type: "url", creating a text input |
| 27 | + qr/\[INFO\] Bad input type: "url", creating a text input\n/ |
| 28 | +); |
| 29 | + |
| 30 | +foreach my $line (<STDIN>) { |
| 31 | + foreach my $regexp (@regexps) { |
| 32 | + my $count = $line =~ s/$regexp//; |
| 33 | + if ($count > 0) { |
| 34 | + # replacement were performed, skip other regexps |
| 35 | + last; |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + print $line; |
| 40 | +} |
0 commit comments