loganalyzer
Version:
A simple log analyzer supporting multiple filters and UI.
8 lines (7 loc) • 2.06 kB
JavaScript
(function(){
'use strict';var $jscomp={scope:{},getGlobal:function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global?global:a}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.patches={};$jscomp.patch=function(a,d){($jscomp.patches[a]=$jscomp.patches[a]||[]).push(d);var c=$jscomp.global;a=a.split(".");for(var b=0;b<a.length-1&&c;b++)c=c[a[b]];a=a[a.length-1];c&&c[a]instanceof Function&&(c[a]=d(c[a]))};$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};if(!$jscomp.global.Symbol){$jscomp.global.Symbol=$jscomp.Symbol;var a=[],d=function(c){return function(b){a=[];b=c(b);for(var d=[],e=0,k=b.length;e<k;e++){var f;a:if(f=b[e],f.length<$jscomp.SYMBOL_PREFIX.length)f=!1;else{for(var g=0;g<$jscomp.SYMBOL_PREFIX.length;g++)if(f[g]!=$jscomp.SYMBOL_PREFIX[g]){f=!1;break a}f=!0}f?a.push(b[e]):d.push(b[e])}return d}};$jscomp.patch("Object.keys",d);$jscomp.patch("Object.getOwnPropertyNames",d);$jscomp.patch("Object.getOwnPropertySymbols",
function(c){return function(b){d.unused=Object.getOwnPropertyNames(b);a.push.apply(c(b));return a}})}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(a){return $jscomp.SYMBOL_PREFIX+a+$jscomp.symbolCounter_++};$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();$jscomp.global.Symbol.iterator||($jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
$jscomp.makeIterator=function(a){$jscomp.initSymbolIterator();var d=a[Symbol.iterator];if(d)return d.call(a);var c=0;return{next:function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}}};var LogAnalyzer=function(a){this.debug_=a.debug;this.filters_=a.filters};
LogAnalyzer.prototype.analyze=function(a,d){var c=a.split("\n");a=[];for(var c=$jscomp.makeIterator(c),b=c.next();!b.done;b=c.next())for(var b=b.value,h=$jscomp.makeIterator(this.filters_),e=h.next();!e.done;e=h.next())b.match(e.value.pattern)&&a.push(d(b));return a};LogAnalyzer.ALL_FILTER_={pattern:"",description:"Filter that catches everything"};
}).call(this)