activityLog = $activityLog; $this->sentryLogger = $sentryLogger; $this->logger = $logger; } /** * Zaloguje exceptionu do ActivityLogu, pripadne do Sentry. */ public function exception(\Throwable $e, ?string $message = null, array $data = []): void { if (isLocalDevelopment()) { throw $e; } if (!($e instanceof FlexiBeeException)) { $this->sentryLogger->captureException($e); } if ($message === null) { $message = $e->getMessage(); } $data = array_merge( [ 'exception_message' => $e->getMessage(), ], $data ); // Lock wait timeout a deadlock nechci logovat do ActivityLogu if ($e instanceof LockWaitTimeoutException || $e instanceof DeadlockException) { return; } $this->activityLog->addActivityLog( ActivityLog::SEVERITY_ERROR, ActivityLog::TYPE_SYNC, $message, array_unique($data) ); } public function activity(string $message, array $data = [], string $severity = ActivityLog::SEVERITY_NOTICE): void { $this->activityLog->addActivityLog( $severity, ActivityLog::TYPE_SYNC, '[FlexiBee] '.$message, $data ); } /** * Zaloguje data do kibany. */ public function data(string $message, array $data): void { if (isLocalDevelopment()) { return; } $this->logger->notice($message, $data); } }