Skip to content

Commit

Permalink
fix: trace string
Browse files Browse the repository at this point in the history
  • Loading branch information
Max committed Nov 6, 2022
1 parent 03397ee commit 0c38513
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/CloudLogHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ public function __construct(array $config)
*/
public function write(array $record): void
{
$e = $record['context']['exception'] ?? null;

if ($e instanceof \Exception) {
$message = "{$e->getMessage()} {$e->getTraceAsString()}";
} else {
$message = $record['formatted'];
}
$this
->cloudLog
->channel($this->channelId)
->log(strtolower($record['level_name']), $record['formatted']);
->log(strtolower($record['level_name']), $message);
}

/**
Expand Down

0 comments on commit 0c38513

Please sign in to comment.