0

another code is with error below Fatal error: Cannot declare class CI_Log, because the name is already in use in C:\xampp\htdocs\system\libraries\Log.php on line 27 error is here side >>> [enter image description here][1] [1]: https://i.stack.imgur.com/2LGtP.jpg

class CI_Log {

    protected $_log_path;
    protected $_threshold   = 1;
    protected $_date_fmt    = 'Y-m-d H:i:s';
    protected $_enabled = TRUE;
    protected $_levels  = array('ERROR' => '1', 'DEBUG' => '2',  'INFO' => '3', 'ALL' => '4');
lockboy
  • 1
  • 1
  • 2
  • Your second error implies that you have imported the module twice. Perhaps you should use `require_once` instead of `require`. – Tim Roberts May 21 '21 at 18:08
  • 1
    Please ask only 1 question at a time as it makes it difficult to properly answer when you need to answer several parts. – Nigel Ren May 21 '21 at 18:09

1 Answers1

0

Do you see what the error is saying? Once you supply a default value for a parameter (as in $level = 'error'), all the parameters after that must also have default values. So, either move your $msg parameter to be first, or supply a default for it ($msg="").

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30
  • I made the correction more error back when I leave it like this public function write_log($level = 'error', $msg ='error' , $php_error = false) – lockboy May 21 '21 at 18:17
  • I can't tell what your sentence says, but that's the right way to write the function. – Tim Roberts May 21 '21 at 18:21