| | |
| | | * @param array $context Additional context (i.e: data that was attempted to be acted on) |
| | | * @param string $severity |
| | | * |
| | | * @return bool Whether it gets logged successfully |
| | | * @return array |
| | | */ |
| | | public function log(string $component, string $message, array $context = [], string $severity = 'error'): array |
| | | { |
| | |
| | | $user_was_logged_in = $user_id > 0 || (!empty($context['isLoggedIn'])); |
| | | |
| | | // Determine source from context |
| | | $source = isset($context['source']) ? $context['source'] : |
| | | (isset($context['url']) ? 'frontend' : 'backend'); |
| | | $source = $context['source'] ?? (isset($context['url']) ? 'frontend' : 'backend'); |
| | | |
| | | $result = $this->table->insert( |
| | | [ |
| | |
| | | ); |
| | | } |
| | | |
| | | $body .= Emails::getInstance()->spacer(20); |
| | | $body .= Emails::getInstance()->spacer(); |
| | | |
| | | // Frequent errors section |
| | | if (!empty($summary['frequent'])) { |