Welcome Guest, Not a member yet? Register   Sign In
MY_Log
#6

[eluser]sophistry[/eluser]
I just made a similar MY_Log.php file and I think it is less code to maintain should the CI Log.php library change substantially.

The class proposed above is fine and it works, but it was too much STUFF to change and adding a config item was not to my taste.

Here is an alternative that just uses the MY_Log.php class extension to override the $_levels var. To use it, you just create your own array items. In my case, I needed to log search items in a text file.

Config file needs log_threshold set to 1:
Code:
$config['log_threshold'] = 1;

So, my log_message() call looks like this:
Code:
log_message('SEARCH', $search_term);

and the MY_log.php file...
Code:
<?php

// override the $_levels array to allow custom levels

class MY_Log extends CI_Log {

    var $_levels    = array('SEARCH' => '1', 'ERROR' => '2', 'DEBUG' => '3',  'INFO' => '4', 'ALL' => '5');
    
    function MY_Log()
    {
        parent::CI_Log();
    }
    
}

/* end of file MY_Log.php */


Messages In This Thread
MY_Log - by El Forum - 06-29-2008, 12:11 AM
MY_Log - by El Forum - 06-30-2008, 11:16 AM
MY_Log - by El Forum - 06-30-2008, 02:54 PM
MY_Log - by El Forum - 08-22-2008, 03:53 PM
MY_Log - by El Forum - 08-22-2008, 04:06 PM
MY_Log - by El Forum - 09-10-2008, 11:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB