From b2af476c9bb3a3eb24f93e7128eee327758461a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 5 Jan 2022 21:27:11 +0200 Subject: Polish changes from PR #5684 and drop ['log_file_extension']; ref #5648 --- system/core/Log.php | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'system') diff --git a/system/core/Log.php b/system/core/Log.php index 8ce1b83a2..999e51718 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -54,13 +54,13 @@ class CI_Log { * @var string */ protected $_log_path; - + /** - * Filename of log + * Log filename * * @var string */ - protected $_log_file; + protected $_log_filename; /** * File permissions @@ -90,13 +90,6 @@ class CI_Log { */ protected $_date_fmt = 'Y-m-d H:i:s'; - /** - * Filename extension - * - * @var string - */ - protected $_file_ext; - /** * Whether or not the logger can write to the log files * @@ -134,11 +127,8 @@ class CI_Log { $this->_log_path = ($config['log_path'] !== '') ? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR; - $this->_log_file = (isset($config['log_file']) && $config['log_file'] !== '') - ? $config['log_file'] : 'log-'.date('Y-m-d'); - - $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') - ? ltrim($config['log_file_extension'], '.') : 'php'; + $this->_log_filename = (isset($config['log_filename']) && $config['log_filename'] !== '') + ? $config['log_filename'] : 'log-'.date('Y-m-d').'.php'; file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE); @@ -194,14 +184,14 @@ class CI_Log { return FALSE; } - $filepath = $this->_log_path.$this->_log_file.'.'.$this->_file_ext; + $filepath = $this->_log_path.$this->_log_filename; $message = ''; if ( ! file_exists($filepath)) { $newfile = TRUE; // Only add protection to php files - if ($this->_file_ext === 'php') + if (substr($this->_log_filename, -3, 3) === 'php') { $message .= "\n\n"; } -- cgit v1.2.3-24-g4f1b