summaryrefslogtreecommitdiffstats
path: root/system/libraries/Log.php
diff options
context:
space:
mode:
authorGreg Aker <greg@gregaker.net>2011-12-25 08:44:33 +0100
committerGreg Aker <greg@gregaker.net>2011-12-25 08:44:33 +0100
commitef38f0a6d83025fbd99ace5ec60311acfe9121c4 (patch)
tree1728bc5df9412d8eccc2919bf3cd3f6bbe6a52d0 /system/libraries/Log.php
parentd90e1a0fb541ee94459a20cf8b0726aebaec9692 (diff)
parenta96ade374f28cdae97036fc253fd8b2a0e8dc81a (diff)
Merge branch 'develop' into feature/unit-tests
Diffstat (limited to 'system/libraries/Log.php')
-rw-r--r--system/libraries/Log.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 6ea905f73..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;
}
@@ -111,7 +109,8 @@ class CI_Log {
if ( ! file_exists($filepath))
{
- $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
+ $newfile = TRUE;
+ $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
}
if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
@@ -126,7 +125,10 @@ class CI_Log {
flock($fp, LOCK_UN);
fclose($fp);
- @chmod($filepath, FILE_WRITE_MODE);
+ if (isset($newfile) AND $newfile === TRUE)
+ {
+ @chmod($filepath, FILE_WRITE_MODE);
+ }
return TRUE;
}
@@ -134,4 +136,4 @@ class CI_Log {
// END Log Class
/* End of file Log.php */
-/* Location: ./system/libraries/Log.php */ \ No newline at end of file
+/* Location: ./system/libraries/Log.php */