[eluser]Unknown[/eluser]
Well it took me a while but I think I found a way to make the CodeIgniter logging mechanism into something useful.
As built, changing the error_reporting() level has no effect on what kinds of php errors get logged. If it's a PHP error, and if you're recording PHP errors via your $config['log_threshold']... even if it's an E_NOTICE, it automatically gets written to the log file.
What this means, in practical terms, is that my logs were filling up with a bunch of inconsequential E_NOTICE messages. I'm not here to argue whether it's wise or not to log E_NOTICEs, I'm just here to offer you a way around it if you so desire.
Add a new configuration field like yea. It's the same bit-scheme as the native PHP error codes you might give to error_reporting()....
Code:
...
$config['log_threshold'] = 1;
$config['log_reporting_level'] = E_ALL ^ E_NOTICE;
...
Then, jam this in libraries...
Code:
class MY_Exceptions extends CI_Exceptions {
function MY_Exceptions() {
parent::CI_Exceptions();
}
function log_exception($severity, $message, $filepath, $line) {
$config =& get_config();
$log_reporting = $config['log_reporting_level'];
if (($severity & $log_reporting) == $severity) {
$severityStr = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
log_message('error', 'Severity: '.$severityStr.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
}
}
}
And that's about it. Now you can control both what gets displayed to the screen and what gets logged.
Next up... maybe I'll replace that model travesty with an actual ORM, and not one based on rails with its retarded pluralization scheme. (Man I want to strangle that guy.)