Skip to content

Commit 759cbcc

Browse files
committed
Fix request duration
1 parent 5872827 commit 759cbcc

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

README-EN.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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

src/Collectors/RequestBasicCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}),

0 commit comments

Comments
 (0)