Yii 1.1: csexcludelogroute

provides negative filters for logs and nested routes
2 followers

CSExcludeLogRoute provides fine-grained, nested negative filters for logs. It works as a filter and transparently send logs matching criteria to nested LogRoutes. Lets you configure scenario like this "log from every category except single subcategory" and similiar.

Requirements

tested in Yii 1.1.10 and 1.1.11 but should work in older versions too

Usage

Just use in config files like this:

'components'=>array(
    'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            //log all logs from every category with every level except logs from 'system.db.*' and 'system.CModule' categories (any level)
            array(
                'class'=>'CSExcludeLogRoute',
                'excludeCategories'=>'system.db.*,system.CModule',
                'routes'=>array(
                    array(
                        'class'=>'CWebLogRoute',
                    ),
                    ...
                ),
            ),
            //log all logs from system.* categories except logs from system.db.* categories which have 'warning' level
            array(
                'class'=>'CSExcludeLogRoute',
                'categories'=>'system.*',
                'excludeCategories'=>'system.db.*',
                'excludeLevels'=>'warning',
                'routes'=>array(
                    array(
                        'class'=>'CWebLogRoute',
                    ),
                    ...
                ),
            ),
            ...
        ),
    ),
    ...
),

To all (the only) subscribers: As soon as Yii 1.1.13 is officialy published this extension is no longer supported as there will be native support for negative filters. Anyway, if someone still uses older version - use this instead :)

Total 3 comments

#10044 report it
acorncom at 2012/10/01 05:38pm
Understood

And thanks for the work! I've just been watching it recently on Github and thought you might want to know: https://github.com/yiisoft/yii/pull/1376

#10043 report it
redguy at 2012/10/01 05:32pm
re: Currently being added to Yii 1.1.13

Nice to hear it. Extension was developed when there was no sign that this could be natively supported...

#10040 report it
acorncom at 2012/10/01 02:52pm
Currently being added to Yii 1.1.13

So in the future, it'll be handled in the framework natively.

Leave a comment

Please to leave your comment.

Create extension