File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,47 @@ array:4 [
110110[2016-05-11 17:19:21]: [INFO]: Memory peak usage: 8 MB.
111111```
112112
113+ If you want to pass additional context to your custom exception, use `Illuminated\Console\RuntimeException`:
114+
115+ ```php
116+ class Foo extends Command
117+ {
118+ use Loggable;
119+
120+ public function handle()
121+ {
122+ throw new RuntimeException(' Oooups! Houston, we have a problem! ' , [
123+ ' some' => 123,
124+ ' extra' => true,
125+ ' context' => null,
126+ ]);
127+ }
128+
129+ // ...
130+ }
131+ ```
132+
133+ ```
134+ [2016-05-11 17:19:21]: [INFO]: Command `App\Console\Commands\Foo` initialized.
135+ [2016-05-11 17:19:21]: [INFO]: Host: `MyHost.local` (`10.0.1.1`).
136+ [2016-05-11 17:19:21]: [INFO]: Database host: `MyHost.local`, port: `3306`, ip: ``.
137+ [2016-05-11 17:19:21]: [INFO]: Database date: `2016-05-11 17:19:21`.
138+ [2016-05-11 17:19:21]: [ERROR]: Oooups! Houston, we have a problem!
139+ array:5 [
140+ "code" => 0
141+ "message" => "Oooups! Houston, we have a problem!"
142+ "file" => "/Applications/MAMP/htdocs/illuminated-console-logger-test/app/Console/Commands/Foo.php"
143+ "line" => 22
144+ "context" => array:3 [
145+ "some" => 123
146+ "extra" => true
147+ "context" => null
148+ ]
149+ ]
150+ [2016-05-11 17:19:21]: [INFO]: Execution time: 0.017 sec.
151+ [2016-05-11 17:19:21]: [INFO]: Memory peak usage: 8 MB.
152+ ```
153+
113154## Auto saving to DB
114155
115156In progress...
You can’t perform that action at this time.
0 commit comments