diff options
author | Andrey Andreev <narf@bofh.bg> | 2011-12-22 19:02:04 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2011-12-22 19:02:04 +0100 |
commit | 76cc9200696b881a3318efd982dbded5f4f2851e (patch) | |
tree | 88d2a21f8b6c16c7be391dd9e55efee21d3045b3 /system/libraries | |
parent | 402a5270d37c8be2bbb19ed32333f6de2db4ef71 (diff) |
Clean up the Log library
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Log.php | 20 |
1 files 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 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -44,7 +44,7 @@ class CI_Log { protected $_threshold_array = array(); protected $_date_fmt = 'Y-m-d H:i:s'; protected $_enabled = TRUE; - protected $_levels = array('ERROR' => '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)) |