message = $message; $this->payload = $payload; } /** * Execute the job. * This runs in the background worker! * * @return void */ public function handle() { try { // This is where the actual CloudWatch connection happens now. // It reuses the Service Provider & Handler we already built. app('audit.logger')->info($this->message, $this->payload); } catch (\Exception $e) { // If CloudWatch fails, log it to local file so we know. // The Queue worker will also mark this job as "failed". Log::error('Queue Worker Failed to Log to CloudWatch: ' . $e->getMessage()); throw $e; } } }