Skip to content

Commit

Permalink
fix logged context not being sent to Flare
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Jan 26, 2021
1 parent 8e907d8 commit 66b3138
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `ignition` will be documented in this file

## 2.5.9 - 2021-01-26

- fix logged context not being sent to Flare

## 2.5.8 - 2020-12-29

- fix double `$` on PHP 8 (#338)
Expand Down
11 changes: 10 additions & 1 deletion src/Logger/FlareHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Facade\Ignition\Logger;

use Facade\FlareClient\Flare;
use Facade\FlareClient\Report;
use Facade\Ignition\Ignition;
use Facade\Ignition\Tabs\Tab;
use Monolog\Handler\AbstractProcessingHandler;
Expand Down Expand Up @@ -54,7 +55,15 @@ protected function write(array $report): void

if (config('flare.send_logs_as_events')) {
if ($this->hasValidLogLevel($report)) {
$this->flare->reportMessage($report['message'], 'Log '.Logger::getLevelName($report['level']));
$this->flare->reportMessage(
$report['message'],
'Log ' . Logger::getLevelName($report['level']),
function (Report $flareReport) use ($report) {
foreach ($report['context'] as $key => $value) {
$flareReport->context($key, $value);
}
}
);
}
}
}
Expand Down

0 comments on commit 66b3138

Please sign in to comment.