LAMPEngineer / angular-laravel-php

Angular 11.0 Laravel 8.0 PHP 8.1 Docker 20.10.7
GNU General Public License v3.0
1 stars 0 forks source link

Laravel log an instance or array #33

Closed LAMPEngineer closed 3 years ago

LAMPEngineer commented 3 years ago

Laravel log an instance or array:

LAMPEngineer commented 3 years ago

Log::info(print_r($user, true));

The true in the second parameter of the print_r() method returns the information instead of printing it, which allows the Log facade to print it like a string.

LAMPEngineer commented 3 years ago

log either by print_r or json_encode. json_encode is more readable.

use Illuminate\Support\Facades\Log;

Log::info(json_encode($user));

LAMPEngineer commented 3 years ago

Done!