Skip to content

Commit 7bfb878

Browse files
author
prophet777
committed
Verbose console
1 parent 77258e2 commit 7bfb878

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Server/App/Dispatcher/TopicDispatcher.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Gos\Bundle\WebSocketBundle\Router\WampRequest;
66
use Gos\Bundle\WebSocketBundle\Router\WampRouter;
77
use Gos\Bundle\WebSocketBundle\Server\App\Registry\TopicRegistry;
8+
use Psr\Log\NullLogger;
89
use Ratchet\ConnectionInterface;
910
use Ratchet\Wamp\Topic;
1011
use Symfony\Component\HttpKernel\Log\LoggerInterface;
@@ -44,7 +45,7 @@ public function __construct(TopicRegistry $topicRegistry, WampRouter $router, Lo
4445
{
4546
$this->topicRegistry = $topicRegistry;
4647
$this->router = $router;
47-
$this->logger = $logger;
48+
$this->logger = null === $logger ? new NullLogger() : $logger;
4849
}
4950

5051
/**
@@ -108,6 +109,12 @@ public function dispatch($calledMethod, ConnectionInterface $conn, Topic $topic,
108109
$appTopic->{$calledMethod}($conn, $topic, $request);
109110
}
110111
} catch (\Exception $e) {
112+
$this->logger->error($e->getMessage(), [
113+
'code' => $e->getCode(),
114+
'file' => $e->getFile(),
115+
'trace' => $e->getTraceAsString()
116+
]);
117+
111118
$conn->callError($topic->getId(), $topic, $e->getMessage(), [
112119
'topic' => $topic,
113120
'request' => $request,

0 commit comments

Comments
 (0)