diff --git a/flexiapi/app/Http/Controllers/Account/PasswordController.php b/flexiapi/app/Http/Controllers/Account/PasswordController.php index 260a34a..197912f 100644 --- a/flexiapi/app/Http/Controllers/Account/PasswordController.php +++ b/flexiapi/app/Http/Controllers/Account/PasswordController.php @@ -46,11 +46,11 @@ class PasswordController extends Controller $account->updatePassword($request->get('password')); if ($account->passwords()->count() > 0) { - Log::channel('events')->info('Web: Password changed', ['id' => $account->identifier]); + Log::info('Web: Password changed', ['id' => $account->identifier]); return redirect()->route('account.logout'); } - Log::channel('events')->info('Web: Password set for the first time', ['id' => $account->identifier]); + Log::info('Web: Password set for the first time', ['id' => $account->identifier]); return redirect()->route('account.logout'); } } diff --git a/flexiapi/app/Http/Controllers/Admin/Account/AccountTypeController.php b/flexiapi/app/Http/Controllers/Admin/Account/AccountTypeController.php index 817568b..53f83ab 100644 --- a/flexiapi/app/Http/Controllers/Admin/Account/AccountTypeController.php +++ b/flexiapi/app/Http/Controllers/Admin/Account/AccountTypeController.php @@ -53,7 +53,7 @@ class AccountTypeController extends Controller $account->types()->detach($request->get('account_type_id')); $account->types()->attach($request->get('account_type_id')); - Log::channel('events')->info('Web Admin: Account type attached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]); + Log::info('Web Admin: Account type attached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]); return redirect()->route('admin.account.show', $account)->withFragment('#types'); } @@ -64,7 +64,7 @@ class AccountTypeController extends Controller $account->types()->detach($typeId); - Log::channel('events')->info('Web Admin: Account type detached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]); + Log::info('Web Admin: Account type detached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]); return redirect()->route('admin.account.show', $account)->withFragment('#types'); } diff --git a/flexiapi/app/Http/Controllers/Admin/Account/ActionController.php b/flexiapi/app/Http/Controllers/Admin/Account/ActionController.php index f27a197..4159478 100644 --- a/flexiapi/app/Http/Controllers/Admin/Account/ActionController.php +++ b/flexiapi/app/Http/Controllers/Admin/Account/ActionController.php @@ -54,7 +54,7 @@ class ActionController extends Controller $accountAction->code = $request->get('code'); $accountAction->save(); - Log::channel('events')->info('Web Admin: Account action created', ['id' => $account->identifier, 'action' => $accountAction->key]); + Log::info('Web Admin: Account action created', ['id' => $account->identifier, 'action' => $accountAction->key]); return redirect()->route('admin.account.show', $accountAction->account)->withFragment('#actions'); } @@ -89,7 +89,7 @@ class ActionController extends Controller $accountAction->code = $request->get('code'); $accountAction->save(); - Log::channel('events')->info('Web Admin: Account action updated', ['id' => $account->identifier, 'action' => $accountAction->key]); + Log::info('Web Admin: Account action updated', ['id' => $account->identifier, 'action' => $accountAction->key]); return redirect()->route('admin.account.show', $account)->withFragment('#actions'); } @@ -115,7 +115,7 @@ class ActionController extends Controller ->firstOrFail(); $accountAction->delete(); - Log::channel('events')->info('Web Admin: Account action deleted', ['id' => $accountAction->account->identifier, 'action_id' => $accountAction->key]); + Log::info('Web Admin: Account action deleted', ['id' => $accountAction->account->identifier, 'action_id' => $accountAction->key]); return redirect()->route('admin.account.show', $accountAction->account)->withFragment('#actions'); } diff --git a/flexiapi/app/Http/Controllers/Admin/Account/ContactController.php b/flexiapi/app/Http/Controllers/Admin/Account/ContactController.php index 0f07173..f79b3ae 100644 --- a/flexiapi/app/Http/Controllers/Admin/Account/ContactController.php +++ b/flexiapi/app/Http/Controllers/Admin/Account/ContactController.php @@ -69,7 +69,7 @@ class ContactController extends Controller $account->contacts()->detach($contact->id); $account->contacts()->attach($contact->id); - Log::channel('events')->info('Web Admin: Account contact added', ['id' => $account->identifier, 'contact' => $contact->identifier]); + Log::info('Web Admin: Account contact added', ['id' => $account->identifier, 'contact' => $contact->identifier]); return redirect()->route('admin.account.contact.index', $account); } @@ -92,7 +92,7 @@ class ContactController extends Controller $account->contacts()->detach($contact->id); - Log::channel('events')->info('Web Admin: Account contact removed', ['id' => $account->identifier, 'contact' => $contact->identifier]); + Log::info('Web Admin: Account contact removed', ['id' => $account->identifier, 'contact' => $contact->identifier]); return redirect()->route('admin.account.contact.index', $account); } diff --git a/flexiapi/app/Http/Controllers/Admin/Account/TypeController.php b/flexiapi/app/Http/Controllers/Admin/Account/TypeController.php index 01ec834..7e9c3d2 100644 --- a/flexiapi/app/Http/Controllers/Admin/Account/TypeController.php +++ b/flexiapi/app/Http/Controllers/Admin/Account/TypeController.php @@ -91,7 +91,7 @@ class TypeController extends Controller $type = AccountType::findOrFail($typeId); $type->delete(); - Log::channel('events')->info('Web Admin: Account type deleted', ['type' => $type->key]); + Log::info('Web Admin: Account type deleted', ['type' => $type->key]); return redirect()->route('admin.account.type.index'); } diff --git a/flexiapi/app/Http/Controllers/Admin/AccountController.php b/flexiapi/app/Http/Controllers/Admin/AccountController.php index 91fb67f..c6e413f 100644 --- a/flexiapi/app/Http/Controllers/Admin/AccountController.php +++ b/flexiapi/app/Http/Controllers/Admin/AccountController.php @@ -110,7 +110,7 @@ class AccountController extends Controller { $account = (new AccountService)->store($request); - Log::channel('events')->info('Web Admin: Account created', ['id' => $account->identifier]); + Log::info('Web Admin: Account created', ['id' => $account->identifier]); return redirect()->route('admin.account.show', $account); } @@ -132,7 +132,7 @@ class AccountController extends Controller { $account = (new AccountService)->update($request, $accountId); - Log::channel('events')->info('Web Admin: Account updated', ['id' => $account->identifier]); + Log::info('Web Admin: Account updated', ['id' => $account->identifier]); return redirect()->route('admin.account.show', $accountId); } @@ -143,7 +143,7 @@ class AccountController extends Controller $account->provision(); $account->save(); - Log::channel('events')->info('Web Admin: Account provisioned', ['id' => $account->identifier]); + Log::info('Web Admin: Account provisioned', ['id' => $account->identifier]); return redirect()->back()->withFragment('provisioning'); } @@ -163,7 +163,7 @@ class AccountController extends Controller (new AccountService)->destroy($request, $request->get('account_id')); - Log::channel('events')->info('Web Admin: Account deleted', ['id' => $account->identifier]); + Log::info('Web Admin: Account deleted', ['id' => $account->identifier]); return redirect()->route('admin.account.index'); } diff --git a/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php b/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php index 036a7a3..5bc3254 100644 --- a/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php +++ b/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php @@ -29,7 +29,7 @@ class ProvisioningEmailController extends Controller Mail::to($account)->send(new Provisioning($account)); - Log::channel('events')->info('Web Admin: Sending provisioning email', ['id' => $account->identifier]); + Log::info('Web Admin: Sending provisioning email', ['id' => $account->identifier]); return redirect()->route('admin.account.show', $account); } diff --git a/flexiapi/app/Http/Controllers/Api/Account/AccountController.php b/flexiapi/app/Http/Controllers/Api/Account/AccountController.php index a1a9775..3706f4f 100644 --- a/flexiapi/app/Http/Controllers/Api/Account/AccountController.php +++ b/flexiapi/app/Http/Controllers/Api/Account/AccountController.php @@ -82,7 +82,7 @@ class AccountController extends Controller $account->provision(); $account->save(); - Log::channel('events')->info('API: Account provisioned', ['id' => $account->identifier]); + Log::info('API: Account provisioned', ['id' => $account->identifier]); return $account->makeVisible(['provisioning_token']); } diff --git a/flexiapi/app/Http/Controllers/Api/Account/CreationTokenController.php b/flexiapi/app/Http/Controllers/Api/Account/CreationTokenController.php index 044836a..db8859f 100644 --- a/flexiapi/app/Http/Controllers/Api/Account/CreationTokenController.php +++ b/flexiapi/app/Http/Controllers/Api/Account/CreationTokenController.php @@ -53,7 +53,7 @@ class CreationTokenController extends Controller ->first(); if ($last) { - Log::channel('events')->info('API: Token throttled', ['token' => $last->token]); + Log::info('API: Token throttled', ['token' => $last->token]); abort(429, 'Last token requested too recently'); } @@ -66,7 +66,7 @@ class CreationTokenController extends Controller $fp = new FlexisipPusherConnector($token->pn_provider, $token->pn_param, $token->pn_prid); if ($fp->sendToken($token->token)) { - Log::channel('events')->info('API: Account Creation Token sent', ['token' => $token->token]); + Log::info('API: Account Creation Token sent', ['token' => $token->token]); $token->save(); return; diff --git a/flexiapi/app/Http/Controllers/Api/Account/PasswordController.php b/flexiapi/app/Http/Controllers/Api/Account/PasswordController.php index a5fc16c..bbac581 100644 --- a/flexiapi/app/Http/Controllers/Api/Account/PasswordController.php +++ b/flexiapi/app/Http/Controllers/Api/Account/PasswordController.php @@ -50,7 +50,7 @@ class PasswordController extends Controller )) { $account->updatePassword($request->get('password'), $algorithm); - Log::channel('events')->info('API: Account password updated', ['id' => $account->identifier]); + Log::info('API: Account password updated', ['id' => $account->identifier]); return response()->json(); } diff --git a/flexiapi/app/Http/Controllers/Api/Account/PushNotificationController.php b/flexiapi/app/Http/Controllers/Api/Account/PushNotificationController.php index 0c0d3a9..4c4e334 100644 --- a/flexiapi/app/Http/Controllers/Api/Account/PushNotificationController.php +++ b/flexiapi/app/Http/Controllers/Api/Account/PushNotificationController.php @@ -27,7 +27,7 @@ class PushNotificationController extends Controller $fp = new FlexisipPusherConnector($request->get('pn_provider'), $request->get('pn_param'), $request->get('pn_prid')); if ($fp->send(callId: $request->get('call_id'), type: $request->get('type'))) { - Log::channel('events')->info('API: Push notification sent', [ + Log::info('API: Push notification sent', [ 'call_id' => $request->get('call_id'), 'type' => $request->get('type') ]); diff --git a/flexiapi/app/Http/Controllers/Api/Account/RecoveryTokenController.php b/flexiapi/app/Http/Controllers/Api/Account/RecoveryTokenController.php index bf153d0..2cdb0cc 100644 --- a/flexiapi/app/Http/Controllers/Api/Account/RecoveryTokenController.php +++ b/flexiapi/app/Http/Controllers/Api/Account/RecoveryTokenController.php @@ -51,7 +51,7 @@ class RecoveryTokenController extends Controller ->first(); if ($last) { - Log::channel('events')->info('API: Token throttled', ['token' => $last->token]); + Log::info('API: Token throttled', ['token' => $last->token]); abort(429, 'Last token requested too recently'); } @@ -64,7 +64,7 @@ class RecoveryTokenController extends Controller $fp = new FlexisipPusherConnector($token->pn_provider, $token->pn_param, $token->pn_prid); if ($fp->sendToken($token->token)) { - Log::channel('events')->info('API: AccountRecoveryToken sent', ['token' => $token->token]); + Log::info('API: AccountRecoveryToken sent', ['token' => $token->token]); $token->save(); return; diff --git a/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php b/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php index 08cf762..c8086e7 100644 --- a/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php +++ b/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php @@ -98,7 +98,7 @@ class AccountController extends Controller (new AccountService())->destroy($request, $accountId); - Log::channel('events')->info('API Admin: Account destroyed', ['id' => $account->identifier]); + Log::info('API Admin: Account destroyed', ['id' => $account->identifier]); } public function activate(Request $request, int $accountId) @@ -107,7 +107,7 @@ class AccountController extends Controller $account->activated = true; $account->save(); - Log::channel('events')->info('API Admin: Account activated', ['id' => $account->identifier]); + Log::info('API Admin: Account activated', ['id' => $account->identifier]); return $account; } @@ -118,7 +118,7 @@ class AccountController extends Controller $account->activated = false; $account->save(); - Log::channel('events')->info('API Admin: Account deactivated', ['id' => $account->identifier]); + Log::info('API Admin: Account deactivated', ['id' => $account->identifier]); return $account; } @@ -129,7 +129,7 @@ class AccountController extends Controller $account->blocked = true; $account->save(); - Log::channel('events')->info('API Admin: Account blocked', ['id' => $account->identifier]); + Log::info('API Admin: Account blocked', ['id' => $account->identifier]); return $account; } @@ -140,7 +140,7 @@ class AccountController extends Controller $account->blocked = false; $account->save(); - Log::channel('events')->info('API Admin: Account unblocked', ['id' => $account->identifier]); + Log::info('API Admin: Account unblocked', ['id' => $account->identifier]); return $account; } @@ -151,7 +151,7 @@ class AccountController extends Controller $account->provision(); $account->save(); - Log::channel('events')->info('API Admin: Account provisioned', ['id' => $account->identifier]); + Log::info('API Admin: Account provisioned', ['id' => $account->identifier]); return $account->makeVisible(['provisioning_token']); } @@ -165,7 +165,7 @@ class AccountController extends Controller { $account = (new AccountService())->update($request, $accountId); - Log::channel('events')->info('API Admin: Account updated', ['id' => $account->identifier]); + Log::info('API Admin: Account updated', ['id' => $account->identifier]); return $account->makeVisible(['provisioning_token']); } @@ -225,7 +225,7 @@ class AccountController extends Controller Mail::to($account)->send(new Provisioning($account)); - Log::channel('events')->info('API: Sending provisioning email', ['id' => $account->identifier]); + Log::info('API: Sending provisioning email', ['id' => $account->identifier]); } public function sendResetPasswordEmail(Request $request, int $accountId) diff --git a/flexiapi/app/Http/Controllers/Api/StatisticsCallController.php b/flexiapi/app/Http/Controllers/Api/StatisticsCallController.php index c38b316..2cfb88f 100644 --- a/flexiapi/app/Http/Controllers/Api/StatisticsCallController.php +++ b/flexiapi/app/Http/Controllers/Api/StatisticsCallController.php @@ -49,7 +49,7 @@ class StatisticsCallController extends Controller try { return $statisticsCall->saveOrFail(); } catch (\Exception $e) { - Log::channel('database_errors')->error($e->getMessage()); + Log::error($e->getMessage()); abort(400, 'Database error'); } } @@ -72,7 +72,7 @@ class StatisticsCallController extends Controller ] ); } catch (\Exception $e) { - Log::channel('database_errors')->error($e->getMessage()); + Log::error($e->getMessage()); abort(400, 'Database error'); } } diff --git a/flexiapi/app/Http/Controllers/Api/StatisticsMessageController.php b/flexiapi/app/Http/Controllers/Api/StatisticsMessageController.php index 53b00e0..9064748 100644 --- a/flexiapi/app/Http/Controllers/Api/StatisticsMessageController.php +++ b/flexiapi/app/Http/Controllers/Api/StatisticsMessageController.php @@ -47,7 +47,7 @@ class StatisticsMessageController extends Controller try { return $statisticsMessage->saveOrFail(); } catch (\Exception $e) { - Log::channel('database_errors')->error($e->getMessage()); + Log::error($e->getMessage()); abort(400, 'Database error'); } } @@ -68,7 +68,7 @@ class StatisticsMessageController extends Controller ['last_status' => $request->get('last_status'), 'received_at' => $request->get('received_at')] ); } catch (\Exception $e) { - Log::channel('database_errors')->error($e->getMessage()); + Log::error($e->getMessage()); abort(400, 'Database error'); } } diff --git a/flexiapi/app/Libraries/OvhSMS.php b/flexiapi/app/Libraries/OvhSMS.php index fb293d2..d87d4bf 100644 --- a/flexiapi/app/Libraries/OvhSMS.php +++ b/flexiapi/app/Libraries/OvhSMS.php @@ -47,7 +47,7 @@ class OvhSMS $this->smsService = $smsServices[0]; } } catch (\Exception $e) { - Log::channel('events')->info('OVH SMS API unreachable, check the errors log'); + Log::info('OVH SMS API unreachable, check the errors log'); Log::error('OVH SMS API not reachable: ' . $e->getMessage()); } } @@ -72,7 +72,7 @@ class OvhSMS 'validityPeriod' => 2880 ]; - Log::channel('events')->info('OVH SMS sending', ['to' => $to, 'message' => $message]); + Log::info('OVH SMS sending', ['to' => $to, 'message' => $message]); try { $this->api->post('/sms/'. $this->smsService . '/jobs', $content); @@ -80,7 +80,7 @@ class OvhSMS $this->api->get('/sms/'. $this->smsService . '/jobs'); } catch (\Exception $e) { - Log::channel('events')->info('OVH SMS not sent, check the errors log'); + Log::info('OVH SMS not sent, check the errors log'); Log::error('OVH SMS not sent: ' . $e->getMessage()); } } diff --git a/flexiapi/app/Services/AccountService.php b/flexiapi/app/Services/AccountService.php index fc9e1f1..31c696c 100644 --- a/flexiapi/app/Services/AccountService.php +++ b/flexiapi/app/Services/AccountService.php @@ -102,10 +102,10 @@ class AccountService $token->account_id = $account->id; $token->save(); - Log::channel('events')->info('API: AccountCreationToken redeemed', ['account_creation_token' => $token->toLog()]); + Log::info('API: AccountCreationToken redeemed', ['account_creation_token' => $token->toLog()]); } - Log::channel('events')->info( + Log::info( $request->asAdmin ? 'Account Service as Admin: Account created' : 'Account Service: Account created', @@ -176,7 +176,7 @@ class AccountService } } - Log::channel('events')->info( + Log::info( $request->asAdmin ? 'Account Service as Admin: Account updated' : 'Account Service: Account updated', @@ -206,7 +206,7 @@ class AccountService (new FlexisipRedisConnector)->pingB2BUA($externalAccount); } - Log::channel('events')->info( + Log::info( 'Account Service: Account destroyed', ['id' => $account->identifier] ); @@ -239,7 +239,7 @@ class AccountService $phoneChangeCode->fillRequestInfo($request); $phoneChangeCode->save(); - Log::channel('events')->info('Account Service: Account phone change requested by SMS', ['id' => $account->identifier]); + Log::info('Account Service: Account phone change requested by SMS', ['id' => $account->identifier]); $message = 'Your ' . $account->space->name . ' validation code is ' . $phoneChangeCode->code . '.'; @@ -278,7 +278,7 @@ class AccountService $account->activated = true; $account->save(); - Log::channel('events')->info('Account Service: Account phone changed using SMS', ['id' => $account->identifier]); + Log::info('Account Service: Account phone changed using SMS', ['id' => $account->identifier]); $account->refresh(); @@ -318,7 +318,7 @@ class AccountService $emailChangeCode->fillRequestInfo($request); $emailChangeCode->save(); - Log::channel('events')->info('Account Service: Account email change requested by email', ['id' => $account->identifier]); + Log::info('Account Service: Account email change requested by email', ['id' => $account->identifier]); Mail::to($emailChangeCode->email)->send(new RegisterValidation($account)); } @@ -349,7 +349,7 @@ class AccountService $account->email = $emailChangeCode->email; $account->save(); - Log::channel('events')->info('Account Service: Account email changed using email', ['id' => $account->identifier]); + Log::info('Account Service: Account email changed using email', ['id' => $account->identifier]); $emailChangeCode->consume(); @@ -380,7 +380,7 @@ class AccountService Mail::to($account)->send(new RecoverByCode($account)); - Log::channel('events')->info('Account Service: Sending recovery email', ['id' => $account->identifier]); + Log::info('Account Service: Sending recovery email', ['id' => $account->identifier]); return $account; } @@ -400,13 +400,13 @@ class AccountService $ovhSMS = new OvhSMS(); $ovhSMS->send($account->phone, $message); - Log::channel('events')->info('Account Service: Sending recovery SMS', ['id' => $account->identifier]); + Log::info('Account Service: Sending recovery SMS', ['id' => $account->identifier]); $accountRecoveryToken->consume(); $accountRecoveryToken->account_id = $account->id; $accountRecoveryToken->save(); - Log::channel('events')->info('API: AccountRecoveryToken redeemed', ['account_recovery_token' => $accountRecoveryToken->toLog()]); + Log::info('API: AccountRecoveryToken redeemed', ['account_recovery_token' => $accountRecoveryToken->toLog()]); return $account; } diff --git a/flexiapi/config/logging.php b/flexiapi/config/logging.php index 42767d4..139478b 100644 --- a/flexiapi/config/logging.php +++ b/flexiapi/config/logging.php @@ -35,57 +35,12 @@ return [ */ 'channels' => [ - 'events' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/events.log'), - 'level' => 'info', - 'days' => 30 - ], - - 'database_errors' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/database_errors.log'), - 'level' => 'error', - 'days' => 30 - ], - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single'], + 'driver' => 'syslog', + 'level' => 'debug', 'ignore_exceptions' => false, ], - 'single' => [ - 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', - ], - - 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', - 'days' => 14, - ], - - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => 'critical', - ], - - 'papertrail' => [ - 'driver' => 'monolog', - 'level' => 'debug', - 'handler' => SyslogUdpHandler::class, - 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), - ], - ], - 'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, @@ -99,16 +54,6 @@ return [ 'driver' => 'syslog', 'level' => 'debug', ], - - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => 'debug', - ], - - 'null' => [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ], ], ];