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

Merge remote-tracking branch 'edsonmedina/master'

This commit is contained in:
Jordi Boggiano
2014-12-04 15:09:24 +00:00

View File

@@ -229,23 +229,12 @@ class Logger implements LoggerInterface
$this->pushHandler(new StreamHandler('php://stderr', static::DEBUG)); $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
} }
if (!static::$timezone) { $levelName = static::getLevelName($level);
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
}
$record = array(
'message' => (string) $message,
'context' => $context,
'level' => $level,
'level_name' => static::getLevelName($level),
'channel' => $this->name,
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
'extra' => array(),
);
// check if any handler will handle this message // check if any handler will handle this message
$handlerKey = null; $handlerKey = null;
foreach ($this->handlers as $key => $handler) { foreach ($this->handlers as $key => $handler) {
if ($handler->isHandling($record)) { if ($handler->isHandling(array('level' => $level))) {
$handlerKey = $key; $handlerKey = $key;
break; break;
} }
@@ -255,6 +244,20 @@ class Logger implements LoggerInterface
return false; return false;
} }
if (!static::$timezone) {
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
}
$record = array(
'message' => (string) $message,
'context' => $context,
'level' => $level,
'level_name' => $levelName,
'channel' => $this->name,
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
'extra' => array(),
);
// found at least one, process message and dispatch it // found at least one, process message and dispatch it
foreach ($this->processors as $processor) { foreach ($this->processors as $processor) {
$record = call_user_func($processor, $record); $record = call_user_func($processor, $record);