Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added documentation for new negating categories feature #1497

Merged
merged 5 commits into from Oct 10, 2012

Conversation

4 participants
Contributor

acorncom commented Sep 28, 2012

Doc addition for pull request #1376

@qiangxue qiangxue and 1 other commented on an outdated diff Sep 29, 2012

docs/guide/topics.logging.txt
+we can prevent certain categories from appearing in our logs:
+
+~~~
+[php]
+array(
+ ......
+ 'preload'=>array('log'),
+ 'components'=>array(
+ ......
+ 'log'=>array(
+ 'class'=>'CLogRouter',
+ 'routes'=>array(
+ array(
+ 'class'=>'CFileLogRoute',
+ 'levels'=>'trace, info',
+ 'categories'=>'!system.CModule, system.*',
@qiangxue

qiangxue Sep 29, 2012

Owner

We are not using this syntax. We use 'except' property instead.

@mdomba

mdomba Oct 1, 2012

Member

As Qiang noted instead of ! there should the an except property with a list of categories that will be prevented.

As for the example to be short and concise IMO you can start with the 'routes' => array - no need for all those lines before that.

In addition if you have time, revisit the CLogRoute.php -> the description of $categories remained Defaults to empty, ... -> should be changed to Defaults to empty array(), ...

Contributor

acorncom commented Oct 1, 2012

Ok, just tweaked those bugs with my pull request. Thoughts?

as exclude is used, there is no need for the ! char

Owner

acorncom replied Oct 1, 2012

Meant to get that the last time :-/

@samdark samdark commented on an outdated diff Oct 2, 2012

docs/guide/topics.logging.txt
@@ -89,6 +89,31 @@ category starts with `system.` are saved. The second route is
[CEmailLogRoute] which sends messages to the specified email addresses.
Only messages whose level is `error` or `warning` are sent.
+In a more advanced example (using an exclude feature available in Yii 1.1.13+),
+we can prevent certain categories from appearing in our logs:
+
+~~~
+[php]
+ 'routes'=>array(
+ array(
+ 'class'=>'CFileLogRoute',
+ 'levels'=>'trace, info',
+ 'categories'=>'system.*',
+ 'exclude'=>'system.CModule', // shows everything from system except CModule level logs
@samdark

samdark Oct 2, 2012

Owner

Logs with category system.CModule exactly?

@samdark samdark commented on an outdated diff Oct 2, 2012

docs/guide/topics.logging.txt
+In a more advanced example (using an exclude feature available in Yii 1.1.13+),
+we can prevent certain categories from appearing in our logs:
+
+~~~
+[php]
+ 'routes'=>array(
+ array(
+ 'class'=>'CFileLogRoute',
+ 'levels'=>'trace, info',
+ 'categories'=>'system.*',
+ 'exclude'=>'system.CModule', // shows everything from system except CModule level logs
+ ),
+ array(
+ 'class'=>'CEmailLogRoute',
+ 'levels'=>'error, warning',
+ 'exclude'=>'system.CModule.*' // Will show everything except any CModule logs
@samdark

samdark Oct 2, 2012

Owner

Logs with category system.CModule.anything?

Contributor

acorncom commented Oct 3, 2012

Cleaned this up to clarify things further.

@samdark per your questions, just went back and looked over the code in more detail. Per the highlighted lines 194-198, it looks like we're excluding in the exact same way we're handling categories. So it does look like we'd be able to leave out system.CModule.anything Would you agree?

@ghost ghost assigned samdark Oct 3, 2012

Owner

samdark commented Oct 3, 2012

My remark was about using system.CModule w/o .*.

Owner

samdark commented Oct 3, 2012

Now everything looks good to me. Will merge it. Thanks for working on it.

@samdark samdark merged commit e973b5d into yiisoft:master Oct 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment