diff --git a/TracyDebugger.module.php b/TracyDebugger.module.php index e0bc416..4658b78 100644 --- a/TracyDebugger.module.php +++ b/TracyDebugger.module.php @@ -27,7 +27,7 @@ public static function getModuleInfo() { 'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__), 'author' => 'Adrian Jones', 'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/', - 'version' => '4.26.31', + 'version' => '4.26.32', 'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first 'singular' => true, 'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4', @@ -217,6 +217,8 @@ static public function getDefaultData() { "outputMode" => 'detect', "showLocation" => array('Tracy\Dumper::LOCATION_SOURCE', 'Tracy\Dumper::LOCATION_LINK', 'Tracy\Dumper::LOCATION_CLASS'), "logSeverity" => array(), + "excludedPwLogFiles" => array('session', 'modules', 'file-compiler'), + "excludedTracyLogFiles" => array(), "numLogEntries" => 10, "collapse" => 14, "collapse_count" => 7, @@ -4289,6 +4291,32 @@ public function getModuleConfigInputfields(array $data) { $fieldset->label = __('ProcessWire and Tracy Log panels', __FILE__); $wrapper->add($fieldset); + $f = $this->wire('modules')->get("InputfieldAsmSelect"); + $f->attr('name', 'excludedPwLogFiles'); + $f->label = __('Excluded PW log files', __FILE__); + $f->description = __('Select log files to be excluded', __FILE__); + $f->notes = __('Useful if you have logs that are written to regularly on user interaction that are overwhelming more useful alert/error/warning logs.', __FILE__); + $f->columnWidth = 50; + $f->setAsmSelectOption('sortable', false); + foreach($this->wire('log')->getLogs() as $k => $v) { + $f->addOption($k); + } + if($data['excludedPwLogFiles']) $f->attr('value', $data['excludedPwLogFiles']); + $fieldset->add($f); + + $f = $this->wire('modules')->get("InputfieldAsmSelect"); + $f->attr('name', 'excludedTracyLogFiles'); + $f->label = __('Excluded Tracy log files', __FILE__); + $f->description = __('Select log files to be excluded', __FILE__); + $f->notes = __('Useful if you have logs that are written to regularly on user interaction that are overwhelming more useful alert/error/warning logs.', __FILE__); + $f->columnWidth = 50; + $f->setAsmSelectOption('sortable', false); + foreach((new \TracyLogsPanel())->getLogs() as $k => $v) { + $f->addOption($k); + } + if($data['excludedTracyLogFiles']) $f->attr('value', $data['excludedTracyLogFiles']); + $fieldset->add($f); + $f = $this->wire('modules')->get("InputfieldInteger"); $f->attr('name', 'numLogEntries'); $f->label = __('Number of log entries', __FILE__); diff --git a/panels/ProcesswireLogsPanel.php b/panels/ProcesswireLogsPanel.php index 5dd0b63..4b86a19 100644 --- a/panels/ProcesswireLogsPanel.php +++ b/panels/ProcesswireLogsPanel.php @@ -48,6 +48,10 @@ public function getTab() { foreach($logs as $log) { + if(in_array($log['name'], \TracyDebugger::getDataValue("excludedPwLogFiles"))) { + continue; + } + if(isset($custom_logs) && array_key_exists($log['name'], $custom_logs_config['customLogsParsed'])) { $isCustom = true; $lines = $custom_logs->getEntries($log['name']); diff --git a/panels/TracyLogsPanel.php b/panels/TracyLogsPanel.php index d3b2ec0..87f68dc 100644 --- a/panels/TracyLogsPanel.php +++ b/panels/TracyLogsPanel.php @@ -43,6 +43,10 @@ public function getTab() { $errorLogs = array('error', 'exception', 'critical'); foreach($logs as $log) { + if(in_array($log['name'], \TracyDebugger::getDataValue("excludedTracyLogFiles"))) { + continue; + } + $lines = \TracyDebugger::tailCustom($this->wire('config')->paths->logs.'tracy/'.$log['name'].'.log', \TracyDebugger::getDataValue("numLogEntries")); $lines = mb_convert_encoding($lines, 'UTF-8'); $lines = explode("\n", $lines);