Log the WebSocket messages
programarivm opened this issue · 0 comments
programarivm commented
The storage/pchess.log
file is now reporting the stack trace of errors and exceptions to keep track of the method calls.
cat pchess.log | grep error
[2024-02-21T19:05:46.230919+00:00] log.ERROR: Occurred an error {"message":"","file":"/usr/share/chess-server/vendor/chesslablab/php-chess/src/Variant/Classical/PGN/Move.php","line":301} []
[2024-02-21T19:05:46.231009+00:00] log.INFO: Sent message {"id":21,"cmd":["error"]} []
[2024-02-23T14:48:16.322775+00:00] log.ERROR: Occurred an error {"message":"","file":"/usr/share/chess-server/vendor/chesslablab/php-chess/src/Variant/Classical/PGN/Move.php","line":301,"trace":"#0 /usr/share/chess-server/vendor/chesslablab/php-chess/src/Variant/Classical/Board.php(701): Chess\\Variant\\Classical\\PGN\\Move->toObj()\n#1 /usr/share/chess-server/vendor/chesslablab/php-chess/src/Variant/Classical/Board.php(743): Chess\\Variant\\Classical\\Board->play()\n#2 /usr/share/chess-server/src/Game/Game.php(171): Chess\\Variant\\Classical\\Board->playLan()\n#3 /usr/share/chess-server/src/Game/AbstractMode.php(103): ChessServer\\Game\\Game->ai()\n#4 /usr/share/chess-server/src/Command/StockfishCommand.php(66): ChessServer\\Game\\AbstractMode->res()\n#5 /usr/share/chess-server/src/Socket/WorkermanWebSocket.php(60): ChessServer\\Command\\StockfishCommand->run()\n#6 /usr/share/chess-server/vendor/workerman/workerman/Connection/TcpConnection.php(646): ChessServer\\Socket\\WorkermanWebSocket->ChessServer\\Socket\\{closure}()\n#7 /usr/share/chess-server/vendor/workerman/workerman/Events/Select.php(311): Workerman\\Connection\\TcpConnection->baseRead()\n#8 /usr/share/chess-server/vendor/workerman/workerman/Worker.php(1638): Workerman\\Events\\Select->loop()\n#9 /usr/share/chess-server/vendor/workerman/workerman/Worker.php(1429): Workerman\\Worker::forkOneWorkerForLinux()\n#10 /usr/share/chess-server/vendor/workerman/workerman/Worker.php(1403): Workerman\\Worker::forkWorkersForLinux()\n#11 /usr/share/chess-server/vendor/workerman/workerman/Worker.php(560): Workerman\\Worker::forkWorkers()\n#12 /usr/share/chess-server/src/Socket/WorkermanWebSocket.php(113): Workerman\\Worker::runAll()\n#13 /usr/share/chess-server/cli/workerman/wss.php(33): ChessServer\\Socket\\WorkermanWebSocket->run()\n#14 {main}"} []
[2024-02-23T14:48:16.322893+00:00] log.INFO: Sent message {"id":68,"cmd":["error"]} []
However, the data causing the errors is not being reported because the WebSocket messages are not being logged.