The Toothpick Logo

LoggingEventPattern

The LoggingEventPattern provides an elegant way to configure complex logging policies. The public protocol is very simple, and consists solely of one class-side instance creation method: #fromString: It was influenced by, and has a syntax similar to, the configuration script for the Unix syslogd system logging daemon, namely the file syslog.conf. For this reason, we've taken the man page for syslog.conf and changed it to explain logging event pattern syntax.

A logging event pattern consists of two parts, a category and a level, separated by a period (``.''). Both parts are case insensitive and can also be specified as decimal numbers, but don't do that, you have been warned. Both categories and priorities are described in Logging Events.

The category may be any Symbol. Most of the examples use the category #debug.

The level is one of the following keywords, in ascending order: #all #debug #info #notice #warn #error #crit #alert #emerg #panic #fatal #off #null. The level defines the severity of the message

The behavior of the original BSD syslogd is that all messages of the specified level and higher are logged according to the given action. The event pattern behaves the same, but has some extensions.

In addition to the above mentioned names the Toothpick LoggingEventPattern understands the following extensions: An asterisk (``*'') stands for all categories or all priorities, depending on where it is used (before or after the period). The keyword none stands for no level of the given category.

You can specify multiple categories with the same level pattern in one statement using the comma (``,'') operator. You may specify as much categories as you want. Remember that only the category part from such a statement is taken, a level part would be skipped.

The Toothpick LoggingEventPattern has a syntax extension to the original BSD source, that makes its use more intuitively. You may precede every level with an equation sign (``='') to specify only this single level and not any of the above. You may also (both is valid, too) precede the level with an exclamation mark (``!'') to ignore all that priorities, either exact this one or this and any higher level. If you use both extensions than the exclamation mark must occur before the equation sign, just use it intuitively.




Published Thursday, October 19, 2006
supported dialects