diff --git a/TracyDebugger.module.php b/TracyDebugger.module.php
index f938221..e0bc416 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.30',
+ 'version' => '4.26.31',
'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',
diff --git a/panels/ProcesswireLogsPanel.php b/panels/ProcesswireLogsPanel.php
index 41815ce..5dd0b63 100644
--- a/panels/ProcesswireLogsPanel.php
+++ b/panels/ProcesswireLogsPanel.php
@@ -42,21 +42,25 @@ public function getTab() {
$errorLogs = array('errors', 'exceptions', 'files-errors');
if($this->wire('modules')->isInstalled('CustomLogs')) {
- $custom_logs = $this->wire('modules')->getModuleConfigData('CustomLogs');
+ $custom_logs = $this->wire('modules')->get('CustomLogs');
+ $custom_logs_config = $custom_logs->data();
}
foreach($logs as $log) {
- if(isset($custom_logs) && array_key_exists($log['name'], $custom_logs['customLogsParsed'])) {
- continue;
+ if(isset($custom_logs) && array_key_exists($log['name'], $custom_logs_config['customLogsParsed'])) {
+ $isCustom = true;
+ $lines = $custom_logs->getEntries($log['name']);
}
-
- $lines = \TracyDebugger::tailCustom($this->wire('config')->paths->logs.$log['name'].'.txt', \TracyDebugger::getDataValue("numLogEntries"));
- $lines = mb_convert_encoding($lines, 'UTF-8');
- $lines = explode("\n", $lines);
- foreach($lines as $key => $line) {
- $entry = $this->wire('log')->lineToEntry($line);
- $lines[$key] = $entry;
+ else {
+ $isCustom = false;
+ $lines = \TracyDebugger::tailCustom($this->wire('config')->paths->logs.$log['name'].'.txt', \TracyDebugger::getDataValue("numLogEntries"));
+ $lines = mb_convert_encoding($lines, 'UTF-8');
+ $lines = explode("\n", $lines);
+ foreach($lines as $key => $line) {
+ $entry = $this->wire('log')->lineToEntry($line);
+ $lines[$key] = $entry;
+ }
}
$x=99;
@@ -73,14 +77,30 @@ public function getTab() {
$logLines = $logLinesData[$log['name']]['lines'];
foreach($logLines as $entry) {
+
+ if(($isCustom && !isset($entry[0])) || (!$isCustom && !isset($entry['date']))) {
+ continue;
+ }
+
$itemKey = $log['name'] . '_' . $x;
- $entriesArr[$itemKey]['timestamp'] = @strtotime($entry['date']); // silenced in case timezone is not set
+ $entriesArr[$itemKey]['timestamp'] = @strtotime($isCustom ? $entry[0] : $entry['date']); // silenced in case timezone is not set
$entriesArr[$itemKey]['linenumber'] = 99-$x;
$entriesArr[$itemKey]['order'] = $itemKey;
- $entriesArr[$itemKey]['date'] = $entry['date'];
- $entriesArr[$itemKey]['text'] = $entry['text'];
- $entriesArr[$itemKey]['user'] = $entry['user'];
- $entriesArr[$itemKey]['url'] = "".$entry['url']."";
+ $entriesArr[$itemKey]['date'] = $isCustom ? $entry[0] : $entry['date'];
+ if($isCustom) {
+ unset($entry[0]);
+ $entry = array_values($entry);
+ $assoc_entry = array();
+ foreach ($entry as $key => $value) {
+ if(isset($custom_logs_config['customLogsParsed'][$log['name']][$key])) {
+ $assoc_entry[str_replace('{url}', '', $custom_logs_config['customLogsParsed'][$log['name']][$key])] = $value;
+ }
+ }
+ $entry = $assoc_entry;
+ }
+ $entriesArr[$itemKey]['text'] = $isCustom ? json_encode($entry) : $entry['text'];
+ $entriesArr[$itemKey]['user'] = $isCustom ? '' : $entry['user'];
+ $entriesArr[$itemKey]['url'] = $isCustom ? '' : "".$entry['url']."";
$entriesArr[$itemKey]['log'] = $log['name'];
$x--;
$this->numLogEntries++;