mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Laravel Vapor - Look into logs in different channel in cloudwatch
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\General\Eloquent\Filters\PaymentMethod;
|
||||
use App\Classes\General\LogHelper;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesGroup;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
|
||||
@@ -69,9 +70,9 @@ class DeletePaidGroupLogic extends AbstractControllerLogic
|
||||
Transaction::where('id', $transactionId)->first()->delete();
|
||||
|
||||
// Now you have the transaction ID available in $transactionId
|
||||
Log::channel('deletePaidGroupOrder')->info("Deleted payment reference transaction ID: " . $transactionId);
|
||||
LogHelper::channel('deletePaidGroupOrder')->info("Deleted payment reference transaction ID: " . $transactionId);
|
||||
} else {
|
||||
Log::channel('deletePaidGroupOrder')->info("no transaction found. Invoice Id ->" . $invoice->id);
|
||||
LogHelper::channel('deletePaidGroupOrder')->info("no transaction found. Invoice Id ->" . $invoice->id);
|
||||
}
|
||||
|
||||
// Store the transaction ID before deleting
|
||||
@@ -79,10 +80,10 @@ class DeletePaidGroupLogic extends AbstractControllerLogic
|
||||
|
||||
// Delete the payment transaction
|
||||
$paymentTransaction->delete();
|
||||
Log::channel('deletePaidGroupOrder')->info("Deleted payment transaction ID: " . $transactionId);
|
||||
LogHelper::channel('deletePaidGroupOrder')->info("Deleted payment transaction ID: " . $transactionId);
|
||||
}
|
||||
|
||||
Log::channel('deletePaidGroupOrder')->info("Deleted Group -> " . $group->id);
|
||||
LogHelper::channel('deletePaidGroupOrder')->info("Deleted Group -> " . $group->id);
|
||||
$this->deletesGroup->execute($group);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\General\Eloquent\Filters\TransactionServiceId;
|
||||
use App\Classes\General\LogHelper;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
@@ -33,14 +34,14 @@ class WalletTransactionResource extends JsonResource
|
||||
case TransactionType::PAYMENT:
|
||||
$invoice = Transaction::where('payment_reference', $this->bill_no)->first();
|
||||
if(!$invoice) {
|
||||
Log::channel('paymentUnknownOrderLog')->info('ID: ' . $this->id);
|
||||
LogHelper::channel('paymentUnknownOrderLog')->info('ID: ' . $this->id);
|
||||
$description = 'Payment for unknown invoice, please contact tech support.';
|
||||
break;
|
||||
}
|
||||
|
||||
$order = $invoice->owner->owner->owner;
|
||||
if(!$order) {
|
||||
Log::channel('paymentUnknownOrderLog')->info('ID: ' . $this->id);
|
||||
LogHelper::channel('paymentUnknownOrderLog')->info('ID: ' . $this->id);
|
||||
$description = 'Payment for unknown order, please contact tech support.';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -131,12 +131,48 @@ return [
|
||||
'level' => 'info',
|
||||
],
|
||||
|
||||
'paymentUnknownOrderLog_vapor' => [
|
||||
'driver' => 'custom',
|
||||
'via' => \App\Logging\CloudWatchLoggerFactory::class,
|
||||
'formatter' => Monolog\Formatter\JsonFormatter::class,
|
||||
'cloudwatch_stream_name' => 'paymentUnknownOrderLog_vapor',
|
||||
'sdk' => [
|
||||
'region' => env('AWS_MY_REGION'),
|
||||
'version' => 'latest',
|
||||
'credentials' => [
|
||||
'key' => env('AWS_CW_ACCESS'),
|
||||
'secret' => env('AWS_CW_SECRET')
|
||||
]
|
||||
],
|
||||
'retention' => 3, //cief todo: retention to be updated
|
||||
'level' => 'debug',
|
||||
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
|
||||
],
|
||||
|
||||
'deletePaidGroupOrder' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/deletePaidGroupOrder.log'),
|
||||
'level' => 'info',
|
||||
],
|
||||
|
||||
'deletePaidGroupOrder_vapor' => [
|
||||
'driver' => 'custom',
|
||||
'via' => \App\Logging\CloudWatchLoggerFactory::class,
|
||||
'formatter' => Monolog\Formatter\JsonFormatter::class,
|
||||
'cloudwatch_stream_name' => 'deletePaidGroupOrder_vapor',
|
||||
'sdk' => [
|
||||
'region' => env('AWS_MY_REGION'),
|
||||
'version' => 'latest',
|
||||
'credentials' => [
|
||||
'key' => env('AWS_CW_ACCESS'),
|
||||
'secret' => env('AWS_CW_SECRET')
|
||||
]
|
||||
],
|
||||
'retention' => 3, //cief todo: retention to be updated
|
||||
'level' => 'debug',
|
||||
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
|
||||
],
|
||||
|
||||
'vue_polling' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel_vue_plling.log'),
|
||||
|
||||
Reference in New Issue
Block a user