Merge pull request #442 from beyondcode/feature/custom-http-stats-logger
[feature] Custom HttpStatisticsLogger instance
This commit is contained in:
commit
79ef005468
|
|
@ -81,6 +81,12 @@ return [
|
|||
*/
|
||||
'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,
|
||||
|
||||
/**
|
||||
* The Statistics Logger will, by default, handle the incoming statistics, store them
|
||||
* and then release them into the database on each interval defined below.
|
||||
*/
|
||||
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger::class,
|
||||
|
||||
/*
|
||||
* Here you can specify the interval in seconds at which statistics should be logged.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use BeyondCode\LaravelWebSockets\Server\Logger\HttpLogger;
|
|||
use BeyondCode\LaravelWebSockets\Server\Logger\WebsocketsLogger;
|
||||
use BeyondCode\LaravelWebSockets\Server\WebSocketServerFactory;
|
||||
use BeyondCode\LaravelWebSockets\Statistics\DnsResolver;
|
||||
use BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger;
|
||||
use BeyondCode\LaravelWebSockets\Statistics\Logger\StatisticsLogger as StatisticsLoggerInterface;
|
||||
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
|
||||
use Clue\React\Buzz\Browser;
|
||||
|
|
@ -61,7 +60,9 @@ class StartWebSocketServer extends Command
|
|||
$browser = new Browser($this->loop, $connector);
|
||||
|
||||
app()->singleton(StatisticsLoggerInterface::class, function () use ($browser) {
|
||||
return new HttpStatisticsLogger(app(ChannelManager::class), $browser);
|
||||
$class = config('websockets.statistics.logger', \BeyondCode\LaravelWebSockets\Statistics\Logger::class);
|
||||
|
||||
return new $class(app(ChannelManager::class), $browser);
|
||||
});
|
||||
|
||||
$this->loop->addPeriodicTimer(config('websockets.statistics.interval_in_seconds'), function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue