Entering two different types of log file in Codeigniter

Is it possible in CI (initially) to enter two different files from two different controllers? I did not find such an option in the user guide or any solution on Google.

Is there any third-party registration library for CI?

+7
logging codeigniter
source share
3 answers

I searched the same, but could not find anything. I changed the code and it works great. I posted the same to the CI forum http://forum.codeigniter.com/thread-25933.html

Look, this will probably serve your purpose.

+5
source share

You can override the log library with your own log class, especially override function write_log($level = 'error', $msg, $php_error = FALSE) . You can see the source code of the log library in the system/libraries/Log.php . To create your own log library by overriding the default behavior, read this page .

Create file system/application/libraries/MY_Log.php :

 class MY_Log extends CI_Log { function MY_Log() { parent::CI_Log(); } //your code //... function write_log($level = 'error', $msg, $php_error = FALSE) { //... } } 
+3
source share

Is it possible in CI (initially) to enter two different files from two different controllers?

No, it is not. Log file names are largely hard-coded. See system/libraries/Log.php

Is there any third-party registration library for CI?

What I don’t know, but assuming that you come empty-handed from Google, I would either ask on the CodeIgniter forums, create my own logging library, or expand the existing one. Instructions

+1
source share

All Articles