PHP code example of enkidu / laravel-log

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

    

enkidu / laravel-log example snippets


try {
        throw new Exception('Test');
    } catch (Exception $exception) {
        \Enkidu\Log\Facades\ExceptionLogger::logException($exception); // exception.log
    }

\Enkidu\Log\Facades\DebugLogger::info('Test'); // debug.log

   'channels' => [
   ...
   'test' => [
        'driver' => 'single',
        'path' => storage_path('logs/test.log'),
        'level' => 'info',
   ],
  ...
]

class TestLogger extends BaseLogger
{
    /**
     * @inheritDoc
     */
    protected function getLoggingChannel(): string
    {
        return 'test';
    }
}

$test = new \App\Logger\TestLogger;
 $test->info('Test'); // test.log