PHP code example of stagerightlabs / command-line-logger

1. Go to this page and download the library: Download stagerightlabs/command-line-logger 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/ */

    

stagerightlabs / command-line-logger example snippets


if ($this->getOutput()->isDebug()) {
    $this->info('To an old pond');
}

if ($this->getOutput()->isVeryVerbose()) {
    $this->info('A frog leaps in');
}

if ($this->getOutput()->isVerbose()) {
    $this->info('And the sound of the water');
}

$this->info('- Matsu Basho');

Log::debug('To an old pond');
Log::info('A frog leaps in');
Log::notice('And the sound of the water');
Log::warning('- Matsu Basho');

'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'console'],
    'ignore_exceptions' => false,
],

// Instead of this
$this->info('Matsu Basho');

// Do this
Log::info('Matsu Basho');

LOG_CHANNEL=stack
LOG_STACK=single,console