|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Classmarkets\RavenBundle; |
|
4
|
|
|
|
|
5
|
|
|
// Since there is no interface for the raven client we have no choice |
|
6
|
|
|
// but to extend the base class, even though this is really a decorator |
|
7
|
|
|
class RecordingRavenClient extends \Raven_Client |
|
8
|
|
|
{ |
|
9
|
|
|
/** @var \Raven_Client */ |
|
10
|
|
|
private $client; |
|
11
|
|
|
|
|
12
|
|
|
/** @var SentryEventRecorder */ |
|
13
|
|
|
private $recorder; |
|
14
|
|
|
|
|
15
|
|
|
public function __construct(\Raven_Client $client, SentryEventRecorder $recorder) |
|
16
|
|
|
{ |
|
17
|
|
|
$this->client = $client; |
|
18
|
|
|
$this->recorder = $recorder; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function captureException($exception, $culpritOrOptions = null, $logger = null, $vars = null) |
|
22
|
|
|
{ |
|
23
|
|
|
$eventId = $this->client->captureException($exception, $culpritOrOptions, $logger, $vars); |
|
24
|
|
|
|
|
25
|
|
|
if ($eventId) { |
|
26
|
|
|
$ident = $this->client->getIdent($eventId); |
|
27
|
|
|
$this->recorder->addExceptionEventId($exception, $ident); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
return $eventId; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
// Delegate all other methods to the real client. Since we don't |
|
34
|
|
|
// implement an interface, we can't use __call, unfortunately. |
|
35
|
|
|
|
|
36
|
|
|
// @codeCoverageIgnoreStart |
|
37
|
|
|
|
|
38
|
|
|
public function getLastError() |
|
39
|
|
|
{ |
|
40
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
41
|
|
|
} |
|
42
|
|
|
public function getIdent($ident) |
|
43
|
|
|
{ |
|
44
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
45
|
|
|
} |
|
46
|
|
|
public function message($message, $params = [], $level = self::INFO, $stack = false, $vars = null) |
|
47
|
|
|
{ |
|
48
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
49
|
|
|
} |
|
50
|
|
|
public function exception($exception) |
|
51
|
|
|
{ |
|
52
|
|
|
// this one is deprecated, so we don't decorate it |
|
53
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
54
|
|
|
} |
|
55
|
|
|
public function captureMessage($message, $params = [], $level_or_options = [], $stack = false, $vars = null) |
|
56
|
|
|
{ |
|
57
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
58
|
|
|
} |
|
59
|
|
|
public function captureQuery($query, $level = self::INFO, $engine = '') |
|
60
|
|
|
{ |
|
61
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
62
|
|
|
} |
|
63
|
|
|
public function get_default_data() |
|
64
|
|
|
{ |
|
65
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
66
|
|
|
} |
|
67
|
|
|
public function capture($data, $stack, $vars = null) |
|
68
|
|
|
{ |
|
69
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
70
|
|
|
} |
|
71
|
|
|
public function sanitize(&$data) |
|
72
|
|
|
{ |
|
73
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
74
|
|
|
} |
|
75
|
|
|
public function process(&$data) |
|
76
|
|
|
{ |
|
77
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
78
|
|
|
} |
|
79
|
|
|
public function sendUnsentErrors() |
|
80
|
|
|
{ |
|
81
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
82
|
|
|
} |
|
83
|
|
|
public function send($data) |
|
84
|
|
|
{ |
|
85
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
86
|
|
|
} |
|
87
|
|
|
public function translateSeverity($severity) |
|
88
|
|
|
{ |
|
89
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
90
|
|
|
} |
|
91
|
|
|
public function registerSeverityMap($map) |
|
92
|
|
|
{ |
|
93
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
94
|
|
|
} |
|
95
|
|
|
public function set_user_data($id, $email = null, $data = []) |
|
96
|
|
|
{ |
|
97
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
98
|
|
|
} |
|
99
|
|
|
public function user_context($data) |
|
100
|
|
|
{ |
|
101
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
102
|
|
|
} |
|
103
|
|
|
public function tags_context($data) |
|
104
|
|
|
{ |
|
105
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
106
|
|
|
} |
|
107
|
|
|
public function extra_context($data) |
|
108
|
|
|
{ |
|
109
|
|
|
return call_user_func_array([$this->client, __FUNCTION__], func_get_args()); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
// @codeCoverageIgnoreEnd |
|
113
|
|
|
} |
|
114
|
|
|
|