CodeIgniter Forums
Log threshold and environment - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Log threshold and environment (/showthread.php?tid=713)



Log threshold and environment - guiweber - 01-08-2015

I think it could be useful to have the environment affect what is logged through log_message(). It is currently possible to limit logs by editing $config['log_threshold'] in config.php, but it's kind of annoying to have to edit your config files every time you move to your production or testing environment.

Why not make the environment constant drive what is logged and what is not? The config file could even specify a log threshold for each environment.


RE: Log threshold and environment - includebeer - 01-11-2015

You can use something like this :

PHP Code:
switch (ENVIRONMENT)
{
 
   case 'development':
 
       $config['log_threshold'] = 2// Debug
 
       break;

 
   case 'testing':
        $config['log_threshold'] = 1// Error
 
       break;

 
   default:
        $config['log_threshold'] = 0// Disabled
 
       break;




RE: Log threshold and environment - Avenirer - 01-12-2015

Hello, you can make different configurations depending on your environment. Please, take a look at this: http://avenir.ro/codeigniter-tutorials/step-2-set-environments/


RE: Log threshold and environment - guiweber - 01-12-2015

Thanks! I didn't know you could have different configuration files. I guess I should take more time to read the doc ;-)