Browse Source

Merge pull request #159 from dlsniper/no-use-speed-bump

Deferred timezone creation
Jordi Boggiano 13 years ago
parent
commit
20c831ef6a
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/Monolog/Logger.php

+ 5 - 4
src/Monolog/Logger.php

@@ -109,10 +109,6 @@ class Logger implements LoggerInterface
     public function __construct($name)
     {
         $this->name = $name;
-
-        if (!static::$timezone) {
-            static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
-        }
     }
 
     /**
@@ -187,6 +183,11 @@ class Logger implements LoggerInterface
         if (!$this->handlers) {
             $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
         }
+
+        if (!static::$timezone) {
+            static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
+        }
+
         $record = array(
             'message' => (string) $message,
             'context' => $context,