1. Go to this page and download the library: Download nanayawkumi/nyk-logger library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Nanayawkumi\NykLogger\Events\AlertSending;
Event::listen(AlertSending::class, function (AlertSending $e) {
if (str_contains($e->payload->message, 'expected noise')) {
return false; // cancel delivery
}
});
use Nanayawkumi\NykLogger\Events\AlertSent;
Event::listen(AlertSent::class, function (AlertSent $e) {
MyIncidentTracker::open($e->payload->toArray());
});
use Nanayawkumi\NykLogger\Facades\NykLogger;
NykLogger::fingerprintUsing(function (string $message, ?\Throwable $e, string $level) {
// Return a string to group on, or null to fall back to the default.
return $e instanceof \App\Exceptions\PaymentException ? 'payments' : null;
});