The Yii logging system is fantastic. A truly versatile system where you can output trace messages to one route and warning messages to another.
One of the options adds an HTML table to the bottom of the current page with all the logs specified for that route>category.
Sometimes, though, you just wanna over-ride this, and display nothing. Maybe in an AJAX pop-up window ….
To disable logging in a particular Controller you can apply the following code;
| PHP | | copy code | | ? |
| 1 | protected function beforeAction($action){ |
| 2 | foreach (Yii::app()->log->routes as $route) { |
| 3 | if ($route instanceof CWebLogRoute) { |
| 4 | $route->enabled = false; |
| 5 | } |
| 6 | } |
| 7 | return true; |
| 8 | } |
Blog
Photography
Portfolio
Yii Part 1