From 7ee71c617fac4f4cd66228f5e50930a7b7fb76f2 Mon Sep 17 00:00:00 2001 From: Seth Phat Date: Wed, 25 Oct 2023 19:45:17 +0700 Subject: [PATCH] ShipSaaS Logger --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e98046a..bc568f5 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ We ship a new Logger driver called `shipsaas-logger` which handles: Thus, it fixes the missing logs issue because we have **independent log files** and not yolo-write into 1 file (which will mess up the logs when having high traffic) 🚀 -And the last step, tell Sumologic (or Cloudwatch, etc.) to sync your logs folder 🔥. All your logs will be on the cloud. +Nowadays, we can just tell Sumologic (or Cloudwatch, DataDog, etc.) to sync your log folder (a whole folder) 🔥. +All your logs will be synced on the cloud. ### Set up `config/logging.php` @@ -63,7 +64,29 @@ LOG_CHANNEL=shipsaas-logger ### Play Now that you have everything, hit some requests and try it out 😎. -And congrats, no more "missing logs" pain for your app 😉. +```php +class TransferController extends BaseController +{ + public function transfer(): JsonResponse + { + Log::info('begin transfer', [ + 'amount' => ..., + 'recipient' => ..., + ]); // this log will have uniqueRequestId + + // ... + + + Log::info('transferred', [ + 'amount' => ..., + 'recipient' => ..., + 'trasaction_id' => ..., + ]); // this log will have uniqueRequestId + } +} +``` + +And also congrats, no more "missing logs" pain for your app 😉. ## Usage (Minimalism)