Skip to content

Commit 7976c13

Browse files
committed
ICL: New section added.
1 parent cb275c5 commit 7976c13

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,36 @@ Provides logging and email notifications for Laravel console commands.
3232
```
3333

3434
3. Now your command is... To be continued...
35+
36+
## Logger is not initialized?
37+
38+
Please note, that `Loggable` trait is overriding `initialize` method:
39+
```php
40+
trait Loggable
41+
{
42+
protected function initialize(InputInterface $input, OutputInterface $output)
43+
{
44+
$this->initializeLogging();
45+
}
46+
47+
// ...
48+
}
49+
```
50+
51+
If your command is overriding `initialize` method too, then you should initialize logger manually:
52+
```php
53+
class Foo extends Command
54+
{
55+
use Loggable;
56+
57+
protected function initialize(InputInterface $input, OutputInterface $output)
58+
{
59+
$this->bar = $this->argument('bar');
60+
$this->baz = $this->argument('baz');
61+
62+
$this->initializeLogging();
63+
}
64+
65+
// ...
66+
}
67+
```

0 commit comments

Comments
 (0)