-
Notifications
You must be signed in to change notification settings - Fork 19
/
class.wp-raven-client.php
executable file
·57 lines (42 loc) · 1.14 KB
/
class.wp-raven-client.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require_once dirname(__FILE__) . '/raven/lib/Raven/Autoloader.php';
Raven_Autoloader::register();
class WP_Raven_Client extends Raven_Client {
protected $settings;
/**
* @var array
*/
protected $errorLevelMap;
public function __construct() {
$this->errorLevelMap = array(
'E_NONE' => 0,
'E_ERROR' => 1,
'E_WARNING' => 2,
'E_PARSE' => 4,
'E_NOTICE' => 8,
'E_USER_ERROR' => 256,
'E_USER_WARNING' => 512,
'E_USER_NOTICE' => 1024,
'E_RECOVERABLE_ERROR' => 4096,
'E_ALL' => 8191);
$this->settings = get_option('sentry-settings');
if (!isset($this->settings['dsn']))
return;
if ($this->settings['dsn'] == '')
return;
parent::__construct($this->settings['dsn']);
$this->setErrorReportingLevel(
$this->settings['reporting_level']);
$this->setHandlers();
}
private function setHandlers() {
$error_handler = new Raven_ErrorHandler($this);
$error_handler->registerErrorHandler();
$error_handler->registerExceptionHandler();
$error_handler->registerShutdownFunction();
}
private function setErrorReportingLevel($level = 'E_ERROR')
{
error_reporting($this->errorLevelMap[$level]);
}
}