From 76cc9200696b881a3318efd982dbded5f4f2851e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 22 Dec 2011 20:02:04 +0200 Subject: Clean up the Log library --- system/libraries/Log.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 46c5b6ed2..7f3a307f3 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -1,13 +1,13 @@ - '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); + protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4); /** * Constructor @@ -62,7 +62,7 @@ class CI_Log { if (is_numeric($config['log_threshold'])) { - $this->_threshold = $config['log_threshold']; + $this->_threshold = (int) $config['log_threshold']; } elseif (is_array($config['log_threshold'])) { @@ -97,12 +97,10 @@ class CI_Log { $level = strtoupper($level); - if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) + if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) + AND ! isset($this->_threshold_array[$this->_levels[$level]])) { - if (empty($this->_threshold_array) OR ! isset($this->_threshold_array[$this->_levels[$level]])) - { - return FALSE; - } + return FALSE; } @@ -112,7 +110,7 @@ class CI_Log { if ( ! file_exists($filepath)) { $newfile = TRUE; - $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; + $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) -- cgit v1.2.3-24-g4f1b