-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve logs, error handling, debug & env usage, refacto curl
- Loading branch information
Showing
15 changed files
with
878 additions
and
258 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.idea/ | ||
/vendor/ | ||
logs/* | ||
vendor/* | ||
var/* |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
require_once(__DIR__ . '/../vendor/autoload.php'); | ||
require_once(__DIR__ . '/../Settings.php'); | ||
|
||
use Killbot\AlertHandler; | ||
use Killbot\Killbot; | ||
use Killbot\Logger; | ||
|
||
set_error_handler( | ||
function ($code, $message, $file, $line) { | ||
throw new ErrorException($message, 0, $code, $file, $line); | ||
} | ||
); | ||
|
||
set_exception_handler( | ||
function ($exception) { | ||
Logger::log($exception->getMessage()); | ||
if (Settings::$ENV === 'PROD' && Settings::$SEND_MAIL) { | ||
AlertHandler::sendAlertMail($exception->getMessage(), $exception->getFile(), $exception->getLine()); | ||
} elseif (Settings::$ENV === 'DEV') { | ||
throw $exception; | ||
} | ||
} | ||
); | ||
|
||
function runBot() | ||
{ | ||
$killbot = new Killbot(); | ||
$killbot->run(); | ||
} | ||
|
||
runBot(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
require_once('vendor/autoload.php'); | ||
|
||
use Killbot\AlertHandler; | ||
|
||
AlertHandler::sendAlertMail('This is a test error message', __FILE__, __LINE__); | ||
|
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
Oops, something went wrong.