Wie füge ich das Protokoll hinzu, wenn die Anforderung http in Laravel aufrufe?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie füge ich das Protokoll hinzu, wenn die Anforderung http in Laravel aufrufe?

by Anonymous » 24 Aug 2025, 00:13

Ich muss im Big -Projekt wie folgt Protokoll nach dem Anruf für Anrufe hinzufügen: < /p>

Code: Select all

$response = Http::get('http://example.com');
Log::info(`add request and header and response`);
< /code>
Ich möchte das globale Protokoll für alle HTTP -Anforderungen definieren. \Illuminate\Support\Facades\Http::macro('log',function(){
Log::info(`add request and header and response`);
});
< /code>
und rufen Sie die HTTP -Anforderung wie folgt auf: < /p>
 $response = Http::get('http://example.com')->log();

Top