1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-13 16:44:23 +02:00

Add the timezone in the the \DateTime constructor. While the DateTime object

is initialized without the DateTimeZone instance, the underline library
execute a stat('.../Europe/Paris') to check if the OS knows the timezone.

This will improve performance on long run process by avoiding unless i/o calls.
This commit is contained in:
Thomas Rabaix
2012-10-24 13:32:05 +02:00
parent 023b31a31f
commit 5e0fabeb0d

View File

@@ -191,7 +191,7 @@ class Logger
'level' => $level, 'level' => $level,
'level_name' => static::getLevelName($level), 'level_name' => static::getLevelName($level),
'channel' => $this->name, 'channel' => $this->name,
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)))->setTimeZone(static::$timezone), 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
'extra' => array(), 'extra' => array(),
); );
// check if any handler will handle this message // check if any handler will handle this message
@@ -339,7 +339,7 @@ class Logger
'level' => $level, 'level' => $level,
'level_name' => static::getLevelName($level), 'level_name' => static::getLevelName($level),
'channel' => $this->name, 'channel' => $this->name,
'datetime' => new \DateTime(), 'datetime' => new \DateTime('now', static::$timezone),
'extra' => array(), 'extra' => array(),
); );