Skip to content

Commit 7ba22b2

Browse files
authored
Fix multiple routes not working when Logger enabled beyondcode#412
1 parent c5c1161 commit 7ba22b2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Server/Logger/WebsocketsLogger.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ class WebsocketsLogger extends Logger implements MessageComponentInterface
1313
/** @var \Ratchet\Http\HttpServerInterface */
1414
protected $app;
1515

16+
/**
17+
* WebsocketsLogger polymorphic constructor for Logger Singleton instanciation and WSServer instanciation
18+
*
19+
* @param MessageComponentInterface|OutputInterface $app
20+
*/
21+
public function __construct($app)
22+
{
23+
if ($app instanceof OutputInterface) {
24+
parent::__construct($app);
25+
} else {
26+
$this->app = $app;
27+
}
28+
}
29+
1630
public static function decorate(MessageComponentInterface $app): self
1731
{
1832
$logger = app(self::class);

0 commit comments

Comments
 (0)