Logging consists of two parts. web::log issues a logging message, while web::logfilter and web::logdest determine where to send a message. Websh uses a two-step filtering. First, Websh determines whether it should handle a message, or not, using the filters configured with web::logfilter. Then, Websh determines which message is to be sent where, using the filters configured with web::logdest.
A filter consists of a tag and a level, separated by a ".". The tag is free text. Typically, it is the name of the application, say "foo". Example: "ws3.debug". Levels are, in order:
Subcommands are: add, delete, and names. Options are: -maxchar, and -format.
Known plug-ins are: file, syslog, command, channel, and apache. Note: the plugins may have indiviudal options (-unbuffered), see documentation below. The format string consits of format specifications for fprintf() plus: p (process id), t (thread id), n (log level), f (log type), and m (the message).
web::logdest add -maxchar 25 -format "%x %X \$l \$m" *.-debug command logTest
Subcommands are: add, delete, and names.
Add a filter to the list.
Issue a log message. It is possible, should the user so desire, to have the web::log run subst on its arguments. This behaviour is turned off by default, and can be turned on by doing:
web::config logsubst 1
.
See the man page for syslog for levels on your system. Typical: 10.
Example 8. web::log
% web::logfilter add *.-debug logfilter0 % web::logdest add *.-debug channel stdout logdest0 % web::log info {Websh is cool} 03/01/00 00:00:00 [111] user.info: Websh is cool % web::logdest delete logdest0 % web::logdest add -format "--> \$m\n" *.-debug channel stdout logdest1 % web::log info {Websh is cool} --> Websh is cool % web::logdest delete logdest1 % web::logdest add -maxchar 5 *.-debug channel stdout % web::log info {Websh is cool} 03/01/00 00:00:00 [111] user.info: Websh %