Logs: Kanal userabo ersetzt, Log-Mails ueber die Queue, weniger Rauschen
Log-Analyse 26.08. (P1-1, P2-1, P2-7, P2-8): - MyLog schrieb in den nicht definierten Kanal userabo (109 EMERGENCY- Eintraege, laravel.log rotierte nicht mehr); jetzt abo_order. - MyLog verschickt die Benachrichtigung ueber die Queue, ein Mailfehler bricht den Zahllauf nicht mehr ab. MailLog sammelt Nutzer, User-Agent und Zeit beim Erzeugen ein, weil der Worker keinen Request hat. - Abgelehnte OAuth-Anfragen (falscher grant_type) werden als Warnung geloggt statt als Fehler gemailt. - payments:check-accounts loggt je Berater nur noch auf debug und schreibt am Ende eine Zusammenfassung (geprueft, versendet, uebersprungen). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ede8e0532d
commit
7daebf32eb
8 changed files with 116 additions and 26 deletions
33
tests/Feature/MyLogNotificationTest.php
Normal file
33
tests/Feature/MyLogNotificationTest.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use App\Mail\MailLog;
|
||||
use App\Services\MyLog;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class);
|
||||
|
||||
it('queues the notification instead of sending it synchronously', function () {
|
||||
Mail::fake();
|
||||
|
||||
MyLog::writeLog('abo_order', 'error', 'Testfehler', ['errorcode' => '5']);
|
||||
|
||||
Mail::assertQueued(MailLog::class);
|
||||
Mail::assertNothingSent();
|
||||
});
|
||||
|
||||
it('does not send a notification when the caller opts out', function () {
|
||||
Mail::fake();
|
||||
|
||||
MyLog::writeLog('abo_order', 'error', 'Testfehler', ['errorcode' => '5'], false);
|
||||
|
||||
Mail::assertNothingQueued();
|
||||
});
|
||||
|
||||
it('does not let a failing notification abort the caller', function () {
|
||||
Mail::shouldReceive('to')->once()->andThrow(new RuntimeException('SMTP down'));
|
||||
|
||||
MyLog::writeLog('abo_order', 'error', 'Testfehler', ['errorcode' => '5']);
|
||||
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue