Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #126 from aizatto/master

Use late static binding
  • Loading branch information...
commit 023b31a31f3807fb19bda1501abb96deacea7c84 2 parents fa292d1 + 938b608
@Seldaek authored
Showing with 23 additions and 23 deletions.
  1. +23 −23 src/Monolog/Logger.php
View
46 src/Monolog/Logger.php
@@ -108,8 +108,8 @@ public function __construct($name)
{
$this->name = $name;
- if (!self::$timezone) {
- self::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
+ if (!static::$timezone) {
+ static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
}
}
@@ -183,15 +183,15 @@ public function popProcessor()
public function addRecord($level, $message, array $context = array())
{
if (!$this->handlers) {
- $this->pushHandler(new StreamHandler('php://stderr', self::DEBUG));
+ $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
}
$record = array(
'message' => (string) $message,
'context' => $context,
'level' => $level,
- 'level_name' => self::getLevelName($level),
+ 'level_name' => static::getLevelName($level),
'channel' => $this->name,
- 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)))->setTimeZone(self::$timezone),
+ 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)))->setTimeZone(static::$timezone),
'extra' => array(),
);
// check if any handler will handle this message
@@ -227,7 +227,7 @@ public function addRecord($level, $message, array $context = array())
*/
public function addDebug($message, array $context = array())
{
- return $this->addRecord(self::DEBUG, $message, $context);
+ return $this->addRecord(static::DEBUG, $message, $context);
}
/**
@@ -239,7 +239,7 @@ public function addDebug($message, array $context = array())
*/
public function addInfo($message, array $context = array())
{
- return $this->addRecord(self::INFO, $message, $context);
+ return $this->addRecord(static::INFO, $message, $context);
}
/**
@@ -251,7 +251,7 @@ public function addInfo($message, array $context = array())
*/
public function addNotice($message, array $context = array())
{
- return $this->addRecord(self::NOTICE, $message, $context);
+ return $this->addRecord(static::NOTICE, $message, $context);
}
/**
@@ -263,7 +263,7 @@ public function addNotice($message, array $context = array())
*/
public function addWarning($message, array $context = array())
{
- return $this->addRecord(self::WARNING, $message, $context);
+ return $this->addRecord(static::WARNING, $message, $context);
}
/**
@@ -275,7 +275,7 @@ public function addWarning($message, array $context = array())
*/
public function addError($message, array $context = array())
{
- return $this->addRecord(self::ERROR, $message, $context);
+ return $this->addRecord(static::ERROR, $message, $context);
}
/**
@@ -287,7 +287,7 @@ public function addError($message, array $context = array())
*/
public function addCritical($message, array $context = array())
{
- return $this->addRecord(self::CRITICAL, $message, $context);
+ return $this->addRecord(static::CRITICAL, $message, $context);
}
/**
@@ -299,7 +299,7 @@ public function addCritical($message, array $context = array())
*/
public function addAlert($message, array $context = array())
{
- return $this->addRecord(self::ALERT, $message, $context);
+ return $this->addRecord(static::ALERT, $message, $context);
}
/**
@@ -311,7 +311,7 @@ public function addAlert($message, array $context = array())
*/
public function addEmergency($message, array $context = array())
{
- return $this->addRecord(self::EMERGENCY, $message, $context);
+ return $this->addRecord(static::EMERGENCY, $message, $context);
}
/**
@@ -322,7 +322,7 @@ public function addEmergency($message, array $context = array())
*/
public static function getLevelName($level)
{
- return self::$levels[$level];
+ return static::$levels[$level];
}
/**
@@ -337,7 +337,7 @@ public function isHandling($level)
'message' => '',
'context' => array(),
'level' => $level,
- 'level_name' => self::getLevelName($level),
+ 'level_name' => static::getLevelName($level),
'channel' => $this->name,
'datetime' => new \DateTime(),
'extra' => array(),
@@ -363,7 +363,7 @@ public function isHandling($level)
*/
public function debug($message, array $context = array())
{
- return $this->addRecord(self::DEBUG, $message, $context);
+ return $this->addRecord(static::DEBUG, $message, $context);
}
/**
@@ -377,7 +377,7 @@ public function debug($message, array $context = array())
*/
public function info($message, array $context = array())
{
- return $this->addRecord(self::INFO, $message, $context);
+ return $this->addRecord(static::INFO, $message, $context);
}
/**
@@ -391,7 +391,7 @@ public function info($message, array $context = array())
*/
public function notice($message, array $context = array())
{
- return $this->addRecord(self::NOTICE, $message, $context);
+ return $this->addRecord(static::NOTICE, $message, $context);
}
/**
@@ -405,7 +405,7 @@ public function notice($message, array $context = array())
*/
public function warn($message, array $context = array())
{
- return $this->addRecord(self::WARNING, $message, $context);
+ return $this->addRecord(static::WARNING, $message, $context);
}
/**
@@ -419,7 +419,7 @@ public function warn($message, array $context = array())
*/
public function err($message, array $context = array())
{
- return $this->addRecord(self::ERROR, $message, $context);
+ return $this->addRecord(static::ERROR, $message, $context);
}
/**
@@ -433,7 +433,7 @@ public function err($message, array $context = array())
*/
public function crit($message, array $context = array())
{
- return $this->addRecord(self::CRITICAL, $message, $context);
+ return $this->addRecord(static::CRITICAL, $message, $context);
}
/**
@@ -447,7 +447,7 @@ public function crit($message, array $context = array())
*/
public function alert($message, array $context = array())
{
- return $this->addRecord(self::ALERT, $message, $context);
+ return $this->addRecord(static::ALERT, $message, $context);
}
/**
@@ -461,6 +461,6 @@ public function alert($message, array $context = array())
*/
public function emerg($message, array $context = array())
{
- return $this->addRecord(self::EMERGENCY, $message, $context);
+ return $this->addRecord(static::EMERGENCY, $message, $context);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.