= 50) break; // Increased limit for general triggers if (empty(trim($line))) continue; // Try to extract timestamp - generic approach $timestamp = 'N/A'; if (preg_match('/^\[(.*?)\]/', $line, $timeMatch)) { $timestamp = $timeMatch[1]; } elseif (preg_match('/^(\d{1,2}\/\d{1,2}\/\d{4}, \d{1,2}:\d{2}\s?[AP]M)/', $line, $timeMatch)) { $timestamp = $timeMatch[1]; } // Pattern 1: Any Trigger Summary completion if (preg_match('/=== (.*?) TRIGGER COMPLETED === (\{.*\})/', $line, $matches)) { $triggerType = $matches[1]; $data = json_decode($matches[2], true); $entries[] = [ 'type' => 'SUMMARY', 'timestamp' => $data['timestamp'] ?? $timestamp, 'trigger_id' => $data['weld_log_id'] ?? ($data['id'] ?? 'N/A'), 'status' => 'COMPLETED', 'message' => "{$triggerType} Trigger execution completed", 'details' => $data ]; } // Pattern 2: Individual trigger execution (WeldLog or others) elseif (preg_match('/(?:WeldLog|System|Batch)?\s?Trigger\s?\[(.*?)\] (.*?) - (STARTED|COMPLETED) (\{.*\})/i', $line, $matches)) { $order = $matches[1]; $process = $matches[2]; $status = $matches[3]; $data = json_decode($matches[4], true); $entries[] = [ 'type' => 'TRIGGER', 'timestamp' => $timestamp, 'trigger_id' => $data['weld_log_id'] ?? ($data['id'] ?? 'N/A'), 'status' => $status, 'message' => "({$order}) {$process}", 'details' => $data ]; } // Pattern 3: Simple Trigger Start/Stop elseif (preg_match('/Trigger (.*?) - (STARTED|COMPLETED) (\{.*\})/i', $line, $matches)) { $process = $matches[1]; $status = $matches[2]; $data = json_decode($matches[3], true); $entries[] = [ 'type' => 'TRIGGER', 'timestamp' => $timestamp, 'trigger_id' => $data['weld_log_id'] ?? ($data['id'] ?? 'N/A'), 'status' => $status, 'message' => $process, 'details' => $data ]; } // Pattern 4: Skipping trigger elseif (stripos($line, 'Skipping trigger:') !== false) { preg_match('/Skipping trigger: (.*?) (\{.*\})/i', $line, $matches); if (count($matches) >= 3) { $process = $matches[1]; $data = json_decode($matches[2], true); $entries[] = [ 'type' => 'SKIP', 'timestamp' => $timestamp, 'trigger_id' => $data['weld_log_id'] ?? ($data['id'] ?? 'N/A'), 'status' => 'SKIPPED', 'message' => "Skipped: {$process}", 'details' => $data ]; } } } } ?>
| Timestamp | Related ID | Process / Message | Status | Details |
|---|---|---|---|---|
| {{ $entry['timestamp'] }} | @if($entry['trigger_id'] !== 'N/A') #{{ $entry['trigger_id'] }} @else - @endif | @if($entry['type'] === 'SUMMARY') @endif {{ $entry['message'] }} | {{ $status }} | |
{{ json_encode($entry['details'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
|
||||
|
No recent trigger log entries found for today. |
||||