Last active
August 3, 2021 16:47
-
-
Save owenconti/e77b882becaf759933231009afcf807b to your computer and use it in GitHub Desktop.
Logging messages to Slack channels with Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'slack' => [ | |
'driver' => 'slack', | |
'url' => env('LOG_SLACK_WEBHOOK_URL'), | |
'username' => 'Oh See Snaps', | |
'emoji' => ':boom:', | |
'level' => 'error' | |
], | |
'slackNotification' => [ | |
'driver' => 'slack', | |
'url' => env('LOG_SLACK_WEBHOOK_URL'), | |
'username' => 'Oh See Snaps', | |
'emoji' => ':wave:', | |
'level' => 'info' | |
] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .env | |
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXXXXX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Log::channel('slackNotification')->info('New user created', [ | |
'name' => $user->name, | |
'email' => $user->email | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment