diff --git a/src/LogFormat.php b/src/LogFormat.php index d11b071..ce6c17c 100644 --- a/src/LogFormat.php +++ b/src/LogFormat.php @@ -32,7 +32,7 @@ public function create($level, $message, array $context = []) $message .= "\n".print_r($context, true); } - return $this->interpolate($message); + return $this->interpolate($message, $context); } /** diff --git a/tests/InterpolateTest.php b/tests/InterpolateTest.php new file mode 100644 index 0000000..41cbd3b --- /dev/null +++ b/tests/InterpolateTest.php @@ -0,0 +1,31 @@ + 'cat', + ]; + + $logger->info('A horse is a {animal}.', $values); + + $logs = $filesystem->read(date('Y-m-d').'.log'); // read the logs into a string + + $containsCat = false; + + if (strpos($logs, 'cat') !== false) { + $containsCat = true; + } + + $this->assertTrue($containsCat); + } +}