You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it may be useful to inspect what Fenrir is doing in the background. For this you can pass a PSR-3 compatible logger. The one used in this example, is a Monolog logger.
This logging will contain HTTP requests being made and all packets sent to and from Discords Gateway.
<?phpuseRagnarok\Fenrir\Discord;
useMonolog\Logger;
useMonolog\Handler\StreamHandler;
useRagnarok\Fenrir\Bitwise\Bitwise;
$log = newLogger('name', [newStreamHandler('/path/to/your.log')]); // Log to a file$log = newLogger('name', [newStreamHandler('php://stdout')]); // Log to stdout (terminal output)$discord = newDiscord(
'TOKEN',
$log
);
$discord
->withGateway(newBitwise())
->withRest();
$discord->gateway->connect(); // Nothing after this line is executed
Note: Monologger is not always an optimal solution as it does not integrate with the ReactPHP event loop to access files. If you want to log to a file, consider using one of the loggers found built with ReactPHP