Skip to content

Commit

Permalink
feat: reduce logging to errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt committed Aug 16, 2024
1 parent 02b0a60 commit 78aaf3a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 53 deletions.
6 changes: 6 additions & 0 deletions app/Console/Commands/DiscordBot.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Discord\Parts\User\Member;
use Discord\WebSockets\Event;
use Discord\WebSockets\Intents;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;

Expand Down Expand Up @@ -73,10 +75,14 @@ public function handle() {
echo 'Please set the DISCORD_ERROR_CHANNEL environment variable.', PHP_EOL;
exit;
}

$logger = new Logger('discord-logger');
$logger->pushHandler(new StreamHandler('php://stdout', Logger::ERROR));
$discord = new Discord([
'token' => $this->token,
'intents' => Intents::getDefaultIntents() | Intents::GUILD_MEMBERS | Intents::GUILDS | Intents::MESSAGE_CONTENT,
'storeMessages' => true,
'logger' => $logger,
]);

$service = new DiscordManager;
Expand Down
106 changes: 53 additions & 53 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78aaf3a

Please sign in to comment.