File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,20 @@ public function report(Exception $e)
9595
9696![ xiZhi] ( docs/xiZhi.jpg )
9797
98+ ## Extend custom channel
99+
100+ Modify the ` boot ` method in the ` app/Providers/AppServiceProvider.php ` file
101+
102+ ``` php
103+ public function boot()
104+ {
105+ // Extend custom channel
106+ \ExceptionNotifier::extend('YourChannel', function (\Illuminate\Contracts\Container\Container $container){
107+ // return instance of the `\Guanguans\LaravelExceptionNotify\Contracts\Channel`.
108+ });
109+ }
110+ ```
111+
98112## Testing
99113
100114``` bash
Original file line number Diff line number Diff line change @@ -97,6 +97,20 @@ public function report(Exception $e)
9797
9898![ 息知] ( docs/xiZhi.jpg )
9999
100+ ## 扩展自定义通道
101+
102+ ` app/Providers/AppServiceProvider.php ` 的 ` boot ` 方法中添加
103+
104+ ``` php
105+ public function boot()
106+ {
107+ // 扩展自定义通道
108+ \ExceptionNotifier::extend('YourChannel', function (\Illuminate\Contracts\Container\Container $container){
109+ // 返回 \Guanguans\LaravelExceptionNotify\Contracts\Channel 的实例
110+ });
111+ }
112+ ```
113+
100114## 测试
101115
102116``` bash
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public function collect()
3333 'Method ' => $ this ->request ->method (),
3434 'Action ' => optional ($ this ->request ->route ())->getActionName (),
3535 'Duration ' => value (function () {
36- $ startTime = defined ('LARAVEL_START ' ) ? LARAVEL_START : $ this ->request ->server ('REQUEST_TIME_FLOAT ' );
36+ $ startTime = defined ('LARAVEL_START ' ) ? LARAVEL_START : $ this ->request ->server ('REQUEST_TIME_FLOAT ' , $ _SERVER [ ' REQUEST_TIME_FLOAT ' ] );
3737
3838 return floor ((microtime (true ) - $ startTime ) * 1000 ).'ms ' ;
3939 }),
You can’t perform that action at this time.
0 commit comments