78 return $record[
'level'] >=
$level;
86 $record = array_reduce(
$records,
function ($highest, $record) {
87 if ($record[
'level'] >= $highest[
'level']) {
101 $record[
'context'][
'logs'] = (string) $this->
getBatchFormatter()->formatBatch($logs);
124 if (!$this->batchFormatter) {
134 protected function write(array $record)
136 $previousUserContext =
false;
138 $options[
'level'] = $this->logLevels[$record[
'level']];
140 if (!empty($record[
'extra'][
'tags'])) {
142 unset($record[
'extra'][
'tags']);
144 if (!empty($record[
'context'][
'tags'])) {
145 $options[
'tags'] = array_merge(
$options[
'tags'], $record[
'context'][
'tags']);
146 unset($record[
'context'][
'tags']);
148 if (!empty($record[
'context'][
'fingerprint'])) {
149 $options[
'fingerprint'] = $record[
'context'][
'fingerprint'];
150 unset($record[
'context'][
'fingerprint']);
152 if (!empty($record[
'context'][
'logger'])) {
153 $options[
'logger'] = $record[
'context'][
'logger'];
154 unset($record[
'context'][
'logger']);
156 $options[
'logger'] = $record[
'channel'];
159 foreach (array(
'extra',
'context') as $source) {
160 if (!empty($record[$source][$key])) {
161 $options[$key] = $record[$source][$key];
162 unset($record[$source][$key]);
166 if (!empty($record[
'context'])) {
167 $options[
'extra'][
'context'] = $record[
'context'];
168 if (!empty($record[
'context'][
'user'])) {
169 $previousUserContext = $this->ravenClient->context->user;
170 $this->ravenClient->user_context($record[
'context'][
'user']);
171 unset(
$options[
'extra'][
'context'][
'user']);
174 if (!empty($record[
'extra'])) {
175 $options[
'extra'][
'extra'] = $record[
'extra'];
178 if (!empty($this->release) && !isset(
$options[
'release'])) {
182 if (isset($record[
'context'][
'exception']) && $record[
'context'][
'exception'] instanceof \Exception) {
183 $options[
'extra'][
'message'] = $record[
'formatted'];
184 $this->ravenClient->captureException($record[
'context'][
'exception'],
$options);
186 $this->ravenClient->captureMessage($record[
'formatted'], array(),
$options);
189 if ($previousUserContext !==
false) {
190 $this->ravenClient->user_context($previousUserContext);
219 return array(
'checksum',
'release');
227 $this->release = $value;
An exception for terminatinating execution or to throw for unit testing.
Base Handler class providing the Handler structure.
handle(array $record)
{Handles a record.All records may be passed to this method, and the handler should discard those that...
processRecord(array $record)
Processes a record.
Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server using raven-php (ht...
__construct(Raven_Client $ravenClient, $level=Logger::DEBUG, $bubble=true)
$logLevels
Translates Monolog log levels to Raven log levels.
write(array $record)
{Writes the record down to the log of the implementing handler.void}
handleBatch(array $records)
{{Handles a set of records at once.}}
getDefaultBatchFormatter()
Gets the default formatter for the logs generated by handleBatch().
getBatchFormatter()
Gets the formatter for the logs generated by handleBatch().
getDefaultFormatter()
Gets the default formatter.FormatterInterface
setBatchFormatter(FormatterInterface $formatter)
Sets the formatter for the logs generated by handleBatch().
getExtraParameters()
Gets extra parameters supported by Raven that can be found in "extra" and "context".
const EMERGENCY
Urgent alert.
const ERROR
Runtime errors.
const CRITICAL
Critical conditions.
const WARNING
Exceptional occurrences that are not errors.
const INFO
Interesting events.
const DEBUG
Detailed debug information.
const NOTICE
Uncommon events.
const ALERT
Action must be taken immediately.
if(!is_array($argv)) $options