Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe that the function you actually want to alter is <code>write_log()</code>, correct me if I'm wrong. You can do this by extending the function within <code>application\libraries\MY_Log.php</code>.</p> <p>I have the following script in my MY_Log.php which emails me any time an error is thrown:</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* Extends the logging class to send an email when an error is triggered */ class MY_Log extends CI_Log { function __construct() { parent::__construct(); } function write_log($level = 'error', $msg, $php_error = FALSE, $additional, $additional2) { if ($this-&gt;_enabled === FALSE) { return FALSE; } $level = strtoupper($level); if ( ! isset($this-&gt;_levels[$level]) OR ($this-&gt;_levels[$level] &gt; $this-&gt;_threshold)) { return FALSE; } $filepath = $this-&gt;_log_path.'log-'.date('Y-m-d').'.php'; $message = ''; if ( ! file_exists($filepath)) { $message .= "&lt;"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?"."&gt;\n\n"; } if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) { return FALSE; } $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this-&gt;_date_fmt). ' --&gt; '.$msg."\n"; flock($fp, LOCK_EX); fwrite($fp, $message); flock($fp, LOCK_UN); fclose($fp); @chmod($filepath, FILE_WRITE_MODE); return TRUE; } } </code></pre> <p>If you're not looking to extend the write function, you will need to extend one of the other log functions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload