72 return $record[
'level'] >=
$level;
80 $record = array_reduce(
$records,
function ($highest, $record) {
81 if ($record[
'level'] >= $highest[
'level']) {
95 $record[
'context'][
'logs'] = (string) $this->
getBatchFormatter()->formatBatch($logs);
118 if (!$this->batchFormatter) {
128 protected function write(array $record)
130 $previousUserContext =
false;
132 $options[
'level'] = $this->logLevels[$record[
'level']];
134 if (!empty($record[
'extra'][
'tags'])) {
136 unset($record[
'extra'][
'tags']);
138 if (!empty($record[
'context'][
'tags'])) {
139 $options[
'tags'] = array_merge(
$options[
'tags'], $record[
'context'][
'tags']);
140 unset($record[
'context'][
'tags']);
142 if (!empty($record[
'context'][
'logger'])) {
143 $options[
'logger'] = $record[
'context'][
'logger'];
144 unset($record[
'context'][
'logger']);
146 $options[
'logger'] = $record[
'channel'];
148 if (!empty($record[
'context'])) {
149 $options[
'extra'][
'context'] = $record[
'context'];
150 if (!empty($record[
'context'][
'user'])) {
151 $previousUserContext = $this->ravenClient->context->user;
152 $this->ravenClient->user_context($record[
'context'][
'user']);
153 unset(
$options[
'extra'][
'context'][
'user']);
156 if (!empty($record[
'extra'])) {
157 $options[
'extra'][
'extra'] = $record[
'extra'];
160 if (isset($record[
'context'][
'exception']) && $record[
'context'][
'exception'] instanceof \Exception) {
161 $options[
'extra'][
'message'] = $record[
'formatted'];
162 $this->ravenClient->captureException($record[
'context'][
'exception'],
$options);
164 $this->ravenClient->captureMessage($record[
'formatted'], array(),
$options);
167 if ($previousUserContext !==
false) {
168 $this->ravenClient->user_context($previousUserContext);
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().
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