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

PHP-Programmierer chatten hier
Anonymous
 Wie füge ich das Protokoll hinzu, wenn die Anforderung http in Laravel aufrufe?

Post by Anonymous »

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();

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post