lbry.com/lib/thirdparty/Slack.class.php
2018-05-21 11:49:15 -04:00

16 lines
492 B
PHP

<?php
class Slack
{
public static function sendErrorIfProd($e, $alert = true)
{
if ($e instanceof Throwable) {
$e = Debug::exceptionToString($e);
}
$slackErrorNotificationUrl = Config::get(Config::SLACK_ERROR_NOTIFICATION_URL);
if ($slackErrorNotificationUrl) {
Curl::post($slackErrorNotificationUrl, ['text' => ($alert ? '<!channel> ' : '') . Request::getRelativeUri() . "\n" . $e], ['json_data' => true]);
}
}
}