Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 5e0ec9e

Browse files
committed
Added defined http logger class in the config
1 parent fddf4d5 commit 5e0ec9e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config/websockets.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@
8181
*/
8282
'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,
8383

84+
/**
85+
* The Statistics Logger will, by default, handle the incoming statistics, store them
86+
* and then release them into the database on each interval defined below.
87+
*/
88+
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger::class,
89+
8490
/*
8591
* Here you can specify the interval in seconds at which statistics should be logged.
8692
*/

src/Console/StartWebSocketServer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ protected function configureStatisticsLogger()
6161
$browser = new Browser($this->loop, $connector);
6262

6363
app()->singleton(StatisticsLoggerInterface::class, function () use ($browser) {
64-
return new HttpStatisticsLogger(app(ChannelManager::class), $browser);
64+
$class = config('websockets.statistics.logger') ?: \BeyondCode\LaravelWebSockets\Statistics\Logger::class;
65+
66+
return new $class(app(ChannelManager::class), $browser);
6567
});
6668

6769
$this->loop->addPeriodicTimer(config('websockets.statistics.interval_in_seconds'), function () {

0 commit comments

Comments
 (0)