Skip to content

dmitry-ivanov/laravel-console-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel console logger

StyleCI SensioLabsInsight

Provides logging and email notifications for Laravel console commands.

Dependencies

  • PHP >=5.4.0
  • Laravel >=5.2

Usage

  1. Install package through composer:

    composer require illuminated/console-logger
  2. Use Illuminated\Console\Loggable trait in your console command class:

    namespace App\Console\Commands;
    
    use Illuminate\Console\Command;
    use Illuminated\Console\Loggable;
    
    class Foo extends Command
    {
        use Loggable;
    
        // ...
    }
  3. Now your command is... To be continued...

Troubleshooting

Note, that Loggable trait is overriding initialize method:

trait Loggable
{
    protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->initializeLogging();
    }

    // ...
}

If your command is overriding initialize method too, then you should call initializeLogging method by yourself:

class Foo extends Command
{
    use Loggable;

    protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->bar = $this->argument('bar');
        $this->baz = $this->argument('baz');

        $this->initializeLogging();
    }

    // ...
}

Packages

No packages published

Languages