Skip to content

Commit

Permalink
Loggers should be able to display non-string elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Feb 5, 2016
1 parent cb71a86 commit 4fcb760
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions system/Log/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ public function log($level, $message, array $context = []): bool
// Parse our placeholders
$message = $this->interpolate($message, $context);

if (! is_string($message))
{
$message = print_r($message, true);
}

if ($this->cacheLogs)
{
$this->logCache[] = [
Expand Down Expand Up @@ -395,6 +400,8 @@ public function log($level, $message, array $context = []): bool
*/
protected function interpolate($message, array $context = [])
{
if (! is_string($message)) return $message;

// build a replacement array with braces around the context keys
$replace = [];

Expand Down

0 comments on commit 4fcb760

Please sign in to comment.