!function(e){var n=e.Core.newType("hafasModule"),r=20,t={byType:{},all:[]},o={INFO:2,WARN:1,ERROR:0},a=o.ERROR,i=[];function l(e,n,r,t,o){this.className="Error",this.logLevel=o,this.type=e,this.sender=n,this.message=r,this.data=t,this.dateTime=(new Date).toLocaleTimeString()}function s(e,n){this.className="LogFilter",this.type=e,this.partOfSender=n,this.check=function(e){return(null===this.type||e.type===this.type)&&(null===this.partOfSender||-1!==e.sender.toLowerCase().indexOf(this.partOfSender.toLowerCase()))}}var u={JS:"JS",STORAGE:"STORAGE",JSON:"JSON",HCI:"HCI",REQUEST:"REQUEST",UNKNOWN:"UNKNOWN"};function c(e){for(var n=0;n<i.length;n++)if(i[n].check(e))return!0;return!1}function p(e){var n,r;e.logLevel===o.ERROR?(n="error",r=console.error):(n="warn",r=console.warn),r("Hafas.logger."+n+"(\n","sender: "+e.sender+", type: "+e.type+", time: "+e.dateTime+"\n","message: "+e.message+"\n",e.data||"","\n)")}function f(e){void 0===t.byType[e.type]&&(t.byType[e.type]=[]),t.byType[e.type].push(e),t.all.push(e),r>0&&(t.all.length>r&&t.all.slice(t.all.length-r),t.byType[e.type].length>r&&t.byType[e.type].slice(t.all.length-r))}n.LOG_LEVEL=o,n.ERROR_TYPES=u,n.info=function(e,n){void 0===n&&(n=e,e=""),a>=o.INFO||c({type:null,sender:e})},n.warn=function(e,n,r,t){var i;return f(i=void 0===n?new l(u.UNKNOWN,"unknown",e,new Error,o.WARN):new l(e,n,r||"",t||new Error,o.WARN)),(a>=o.WARN||c(i))&&p(i),i},n.error=function(n,r,t,a){var i;return f(i=void 0===r?new l(u.UNKNOWN,"unknown",n,new Error,o.ERROR):new l(n,r,t||"",a||new Error,o.ERROR)),p(i),!0===e.Config.Switches.useTracking&&e.Config.Switches.useJSErrorTracking&&"undefined"!=typeof _paq&&_paq.push(["trackEvent","JavaScript Errors",r+" "+t,a]),i},n.setLogLevel=function(e){a=o[e]||0},n.addLogFilter=function(e,n){"ALL"===e&&(e=null),""===n&&(n=null),i.push(new s(e,n))},n.clearLogFilter=function(){i=[]},n.getAll=function(){return t.all},n.getByType=function(e){return t.byType||[]},n.searchBySender=function(e){for(var n=[],r=0;r<t.all.length;r++)-1!==t.all[r].sender.toLowerCase().indexOf(e.toLowerCase())&&n.push(t.all[r]);return n},e.Core.registerModule("logger",n),e.logger=n}(window.Hafas=window.Hafas||{});