| | |
| | | <?php |
| | | namespace JVBase\rest; |
| | | |
| | | use JVBase\inc\managers\ErrorHelper; |
| | | use JVBase\integrations\services\Cloudflare; |
| | | use JVBase\managers\Cache; |
| | | use JVBase\managers\Errors; |
| | |
| | | */ |
| | | abstract class Rest |
| | | { |
| | | use ErrorHelper; |
| | | protected string $namespace = 'jvb/v1'; |
| | | protected ?Cache $cache = null; |
| | | protected string $cacheName = ''; |
| | |
| | | ]); |
| | | |
| | | try { |
| | | Errors::getInstance()->log('security_audit', $event, $context, 'info'); |
| | | $this->logError($event,'auditLog', $context); |
| | | } catch (Exception $e) { |
| | | error_log("Security Audit: {$event} - " . json_encode($context)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Log errors with proper context |
| | | */ |
| | | protected function logError(string $message, array $context = [], string $severity = 'error'): void |
| | | { |
| | | try { |
| | | Errors::getInstance()->log(static::class, $message, $context, $severity); |
| | | } catch (Exception $e) { |
| | | error_log(static::class . " Error: {$message} - " . json_encode($context)); |
| | | } |
| | | } |
| | | |
| | | /************************************************************ |
| | | SESSION FINGERPRINT |
| | | ************************************************************/ |