PHP code example of spatie / laravel-log-dumper

1. Go to this page and download the library: Download spatie/laravel-log-dumper 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/ */

    

spatie / laravel-log-dumper example snippets


ld('a string', ['an array'], new Class());

ld('a string', ['an array'], new Class());

// logs using the `error` level
ld()->error('a string', ['an array'], new Class())

ld()
   ->debug('Debug info', ['an array'])
   ->error('Error info', new Class);

ld('foo'); // will be logged

ld()->disable();

ld('bar'); // will not be logged

ld()->enable();

ld('baz'); // will be logged

foreach (range(1, 3) as $i) {
   // only things in the third iteration will be logged
   ld()->enable($i === 3);

   ld('we are in the third iteration');
}

ld()->logQueries(); // all queries after this call will be logged

ld()->stopLoggingQueries(); // all queries after this call will not be logged anymore

ld()->logQueries(function() {
    $this->mailAllUsers(); // all queries executed in this closure will be logged
});

User::get(); // this query will not be logged