diff options
-rw-r--r-- | core/Log.php | 23 | ||||
-rw-r--r-- | core/Log/Backend/StdErrBackend.php | 3 |
2 files changed, 24 insertions, 2 deletions
diff --git a/core/Log.php b/core/Log.php index f759b351d7..7ca7721f5e 100644 --- a/core/Log.php +++ b/core/Log.php @@ -8,6 +8,7 @@ namespace Piwik; +use Monolog\Logger; use Piwik\Container\StaticContainer; use Piwik\Db; @@ -255,7 +256,7 @@ class Log extends Singleton 'message' => $message, 'context' => $parameters, 'channel' => 'piwik', - 'level' => $level, + 'level' => $this->getMonologLevel($level), 'level_name' => self::getStringLevel($level), 'time' => new \DateTime(), 'extra' => array(), @@ -336,4 +337,24 @@ class Log extends Singleton ); return $levelToName[$level]; } + + private function getMonologLevel($level) + { + switch ($level) { + case self::ERROR: + return Logger::ERROR; + case self::WARN: + return Logger::WARNING; + case self::INFO: + return Logger::INFO; + case self::DEBUG: + return Logger::DEBUG; + case self::VERBOSE: + return Logger::DEBUG; + case self::NONE: + default: + // Highest level possible, need to do better in the future... + return Logger::EMERGENCY; + } + } } diff --git a/core/Log/Backend/StdErrBackend.php b/core/Log/Backend/StdErrBackend.php index 8f8bb00252..32443322f6 100644 --- a/core/Log/Backend/StdErrBackend.php +++ b/core/Log/Backend/StdErrBackend.php @@ -8,6 +8,7 @@ namespace Piwik\Log\Backend; +use Monolog\Logger; use Piwik\Log; use Piwik\Log\Formatter\Formatter; @@ -30,7 +31,7 @@ class StdErrBackend extends Backend public function __invoke(array $record, Log $logger) { - if ($record['level'] != Log::ERROR) { + if ($record['level'] < Logger::ERROR) { return; } |