diff --git a/lib/Analog/Logger.php b/lib/Analog/Logger.php index b44e3b7..d0d1fbb 100644 --- a/lib/Analog/Logger.php +++ b/lib/Analog/Logger.php @@ -52,6 +52,8 @@ * @author Johnny Broadway */ class Logger implements LoggerInterface { + private $handler = null; + /** * Converts from PSR-3 log levels to Analog log levels. */ @@ -130,7 +132,7 @@ private function interpolate ($message, array $context = array ()) { * Sets the Analog log handler. */ public function handler ($handler) { - Analog::handler ($handler); + $this->handler = $handler; } /** @@ -212,6 +214,10 @@ public function log ($level, $message, array $context = array ()) { * Perform the logging to Analog after the log level has been converted. */ private function _log ($level, $message, $context) { + if ($this->handler != null) { + Analog::handler ($this->handler); + } + Analog::log ( $this->interpolate ($message, $context), $level