From 288379344189ffbe3688cd5656c954b258f785af Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Tue, 31 Mar 2026 22:01:14 -0300 Subject: [PATCH] chore: remove verbose Log::info from all publishers --- app/Services/Social/BlueskyPublisher.php | 17 --------- .../Social/LinkedInTokenSynchronizer.php | 8 ---- app/Services/Social/MastodonPublisher.php | 13 ------- app/Services/Social/PinterestPublisher.php | 37 ------------------- app/Services/Social/ThreadsPublisher.php | 20 ---------- 5 files changed, 95 deletions(-) diff --git a/app/Services/Social/BlueskyPublisher.php b/app/Services/Social/BlueskyPublisher.php index add9fdc8..41895497 100644 --- a/app/Services/Social/BlueskyPublisher.php +++ b/app/Services/Social/BlueskyPublisher.php @@ -72,12 +72,6 @@ public function publish(PostPlatform $postPlatform): array $record['facets'] = $facets; } - Log::info('Bluesky publishing post', [ - 'user_id' => $account->platform_user_id, - 'has_embed' => $embed !== null, - 'facet_count' => count($facets), - ]); - $response = Http::withToken($account->access_token) ->post("{$service}/xrpc/com.atproto.repo.createRecord", [ 'repo' => $account->platform_user_id, @@ -100,11 +94,6 @@ public function publish(PostPlatform $postPlatform): array $uri = data_get($data, 'uri'); $postId = basename($uri); - Log::info('Bluesky post created successfully', [ - 'uri' => $uri, - 'post_id' => $postId, - ]); - return [ 'id' => $postId, 'url' => $this->buildPostUrl($account->username, $postId), @@ -272,8 +261,6 @@ public function refreshToken(SocialAccount $account): void { $service = $account->meta['service'] ?? 'https://bsky.social'; - Log::info('Bluesky refreshing token', ['user_id' => $account->platform_user_id]); - // Try refresh first $response = Http::withToken($account->refresh_token) ->post("{$service}/xrpc/com.atproto.server.refreshSession"); @@ -286,8 +273,6 @@ public function refreshToken(SocialAccount $account): void 'token_expires_at' => now()->addHours(2), ]); - Log::info('Bluesky token refreshed via refresh token'); - return; } @@ -315,8 +300,6 @@ public function refreshToken(SocialAccount $account): void 'token_expires_at' => now()->addHours(2), ]); - Log::info('Bluesky token refreshed via re-authentication'); - return; } } catch (\Exception $e) { diff --git a/app/Services/Social/LinkedInTokenSynchronizer.php b/app/Services/Social/LinkedInTokenSynchronizer.php index 61146cb0..5a20de65 100644 --- a/app/Services/Social/LinkedInTokenSynchronizer.php +++ b/app/Services/Social/LinkedInTokenSynchronizer.php @@ -7,7 +7,6 @@ use App\Enums\SocialAccount\Platform; use App\Models\SocialAccount; use App\Models\Workspace; -use Illuminate\Support\Facades\Log; class LinkedInTokenSynchronizer { @@ -30,13 +29,6 @@ public function syncTokens(SocialAccount $sourceAccount): void return; } - Log::info('Syncing LinkedIn tokens between accounts', [ - 'source_id' => $sourceAccount->id, - 'source_platform' => $sourceAccount->platform->value, - 'target_id' => $targetAccount->id, - 'target_platform' => $targetAccount->platform->value, - ]); - $targetAccount->update([ 'access_token' => $sourceAccount->access_token, 'refresh_token' => $sourceAccount->refresh_token, diff --git a/app/Services/Social/MastodonPublisher.php b/app/Services/Social/MastodonPublisher.php index 179b7c06..073a3e4f 100644 --- a/app/Services/Social/MastodonPublisher.php +++ b/app/Services/Social/MastodonPublisher.php @@ -41,12 +41,6 @@ public function publish(PostPlatform $postPlatform): array $payload['media_ids'] = $mediaIds; } - Log::info('Mastodon publishing status', [ - 'instance' => $instance, - 'user_id' => $account->platform_user_id, - 'has_media' => count($mediaIds) > 0, - ]); - $response = Http::withToken($account->access_token) ->post("{$instance}/api/v1/statuses", $payload); @@ -60,11 +54,6 @@ public function publish(PostPlatform $postPlatform): array $data = $response->json(); - Log::info('Mastodon post created', [ - 'id' => data_get($data, 'id'), - 'url' => data_get($data, 'url'), - ]); - return [ 'id' => data_get($data, 'id'), 'url' => data_get($data, 'url'), @@ -113,8 +102,6 @@ private function uploadMedia(SocialAccount $account, string $instance, string $u $data = $response->json(); - Log::info('Mastodon media uploaded', ['id' => data_get($data, 'id')]); - return data_get($data, 'id'); } catch (\Exception $e) { Log::error('Mastodon media upload error', [ diff --git a/app/Services/Social/PinterestPublisher.php b/app/Services/Social/PinterestPublisher.php index 27468ff4..28f7e97c 100644 --- a/app/Services/Social/PinterestPublisher.php +++ b/app/Services/Social/PinterestPublisher.php @@ -50,12 +50,6 @@ private function publishImagePin(PostPlatform $postPlatform): array throw new \Exception('Pinterest board_id is required'); } - Log::info('Pinterest publishing image pin', [ - 'user_id' => $account->platform_user_id, - 'board_id' => $boardId, - 'image_url' => $media->url, - ]); - // Download and optimize image $tempFile = tempnam(sys_get_temp_dir(), 'pin_image_'); @@ -113,8 +107,6 @@ private function publishImagePin(PostPlatform $postPlatform): array $data = $response->json(); - Log::info('Pinterest pin created successfully', ['pin_id' => data_get($data, 'id')]); - return [ 'id' => data_get($data, 'id'), 'url' => 'https://pinterest.com/pin/'.data_get($data, 'id'), @@ -136,11 +128,6 @@ private function publishVideoPin(PostPlatform $postPlatform): array throw new \Exception('Pinterest board_id is required'); } - Log::info('Pinterest publishing video pin', [ - 'user_id' => $account->platform_user_id, - 'board_id' => $boardId, - ]); - // Step 1: Register media upload $registerResponse = Http::withToken($account->access_token) ->post(self::API_BASE.'/media', [ @@ -158,8 +145,6 @@ private function publishVideoPin(PostPlatform $postPlatform): array $registerData = $registerResponse->json(); $mediaId = $registerData['media_id']; - Log::info('Pinterest media registered', ['media_id' => $mediaId]); - // Step 2: Upload video to S3 $uploadParams = $registerData['upload_parameters'] ?? []; $uploadUrl = $registerData['upload_url'] ?? null; @@ -208,8 +193,6 @@ private function publishVideoPin(PostPlatform $postPlatform): array throw new \Exception('Pinterest video upload failed'); } - Log::info('Pinterest video uploaded'); - // Step 3: Wait for processing $this->waitForMediaProcessing($account, $mediaId); @@ -251,8 +234,6 @@ private function publishVideoPin(PostPlatform $postPlatform): array $data = $response->json(); - Log::info('Pinterest video pin created successfully', ['pin_id' => data_get($data, 'id')]); - return [ 'id' => data_get($data, 'id'), 'url' => 'https://pinterest.com/pin/'.data_get($data, 'id'), @@ -274,12 +255,6 @@ private function publishCarousel(PostPlatform $postPlatform): array throw new \Exception('Pinterest board_id is required'); } - Log::info('Pinterest publishing carousel', [ - 'user_id' => $account->platform_user_id, - 'board_id' => $boardId, - 'image_count' => $medias->count(), - ]); - $items = $medias->map(fn ($media) => [ 'url' => $media->url, ])->toArray(); @@ -317,8 +292,6 @@ private function publishCarousel(PostPlatform $postPlatform): array $data = $response->json(); - Log::info('Pinterest carousel created successfully', ['pin_id' => data_get($data, 'id')]); - return [ 'id' => data_get($data, 'id'), 'url' => 'https://pinterest.com/pin/'.data_get($data, 'id'), @@ -345,12 +318,6 @@ private function waitForMediaProcessing(SocialAccount $account, string $mediaId, $data = $response->json(); $status = data_get($data, 'status', 'unknown'); - Log::info('Pinterest media processing status', [ - 'media_id' => $mediaId, - 'status' => $status, - 'attempt' => $i, - ]); - if ($status === 'succeeded') { return; } @@ -368,8 +335,6 @@ private function waitForMediaProcessing(SocialAccount $account, string $mediaId, public function refreshToken(SocialAccount $account): void { - Log::info('Pinterest refreshing token', ['user_id' => $account->platform_user_id]); - $response = Http::asForm() ->withBasicAuth( config('services.pinterest.client_id'), @@ -392,8 +357,6 @@ public function refreshToken(SocialAccount $account): void 'refresh_token' => data_get($data, 'refresh_token', $account->refresh_token), 'token_expires_at' => data_get($data, 'expires_in') ? now()->addSeconds(data_get($data, 'expires_in')) : now()->addDays(30), ]); - - Log::info('Pinterest token refreshed successfully'); } /** diff --git a/app/Services/Social/ThreadsPublisher.php b/app/Services/Social/ThreadsPublisher.php index 2105c525..ada9eb2f 100644 --- a/app/Services/Social/ThreadsPublisher.php +++ b/app/Services/Social/ThreadsPublisher.php @@ -97,8 +97,6 @@ private function publishImagePost(string $userId, string $accessToken, ?string $ $containerId = $containerResponse->json()['id']; - Log::info('Threads image container created', ['container_id' => $containerId]); - // Step 2: Wait for image processing $this->waitForMediaProcessing($containerId, $accessToken); @@ -108,8 +106,6 @@ private function publishImagePost(string $userId, string $accessToken, ?string $ private function publishVideoPost(string $userId, string $accessToken, ?string $content, $media): array { - Log::info('Threads publishing video post', ['user_id' => $userId]); - // Step 1: Create container $containerResponse = Http::post("{$this->baseUrl}/{$userId}/threads", [ 'media_type' => 'VIDEO', @@ -137,11 +133,6 @@ private function publishVideoPost(string $userId, string $accessToken, ?string $ private function publishCarousel(string $userId, string $accessToken, ?string $content, $mediaCollection): array { - Log::info('Threads publishing carousel', [ - 'user_id' => $userId, - 'media_count' => $mediaCollection->count(), - ]); - // Step 1: Create containers for each media item $childContainers = []; @@ -229,8 +220,6 @@ private function publishContainer(string $userId, string $accessToken, string $c $permalink = $permalinkResponse->json()['permalink'] ?? null; - Log::info('Threads publish success', ['media_id' => $mediaId, 'permalink' => $permalink]); - return [ 'id' => $mediaId, 'url' => $permalink, @@ -259,13 +248,6 @@ private function waitForMediaProcessing(string $containerId, string $accessToken $data = $statusResponse->json(); $status = data_get($data, 'status', 'UNKNOWN'); - Log::info('Threads media processing status', [ - 'container_id' => $containerId, - 'status' => $status, - 'attempt' => $i, - 'response' => $data, - ]); - if ($status === 'FINISHED') { return; } @@ -304,8 +286,6 @@ private function refreshToken(SocialAccount $account): void 'refresh_token' => $newToken, 'token_expires_at' => data_get($data, 'expires_in') ? now()->addSeconds(data_get($data, 'expires_in')) : null, ]); - - Log::info('Threads token refreshed successfully'); } private function handleApiError(Response $response): never