Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

apache::testtrace(3) [redhat man page]

Apache::TestTrace(3)					User Contributed Perl Documentation				      Apache::TestTrace(3)

Apache::TestTrace - Helper output generation functions
SYNOPSIS
use Apache::TestTrace; # test sub that exercises all the tracing functions sub test { print $Apache::TestTrace::LogFH "TraceLevel: $Apache::TestTrace::Level "; $_->($_,[1..3],$_) for qw(emerg alert crit error warning notice info debug todo); print $Apache::TestTrace::LogFH " " }; # demo the trace subs using default setting test(); { # override the default trace level with 'crit' local $Apache::TestTrace::Level = 'crit'; # now only 'crit' and higher levels will do tracing lower level test(); } { # set the trace level to 'debug' local $Apache::TestTrace::Level = 'debug'; # now only 'debug' and higher levels will do tracing lower level test(); } { open OUT, ">/tmp/foo" or die $!; # override the default Log filehandle local $Apache::TestTrace::LogFH = *OUT; # now the traces will go into a new filehandle test(); close OUT; } DESCRIPTION
This module exports a number of functions that make it easier generating various diagnostics messages in your programs in a consistent way and saves some keystrokes as it handles the new lines and sends the messages to STDERR for you. This module provides the same trace methods as syslog(3)'s log levels. Listed from low level to high level: emerg(), alert(), crit(), error(), warning(), notice(), info(), debug(). The only different function is warning(), since warn is already taken by Perl. The module provides another trace function called todo() which is useful for todo items. It has the same level as debug (the highest). If you have "Term::ANSIColor" installed the diagnostic messages will be colorized, otherwise a special for each function prefix will be used. If "Data::Dumper" is installed and you pass a reference to a variable to any of these functions, the variable will be dumped with "Data::Dumper::Dumper()". Functions whose level is above the level set in $Apache::TestTrace::Level become NOPs. For example if the level is set to alert, only alert() and emerg() functions will generate the output. The default setting of this variable is warning. Other valid values are: emerg, alert, crit, error, warning, notice, info, debug. By default all the output generated by these functions goes to STDERR. You can override the default filehandler by overriding $Apache::TestTrace::LogFH with a new filehandler. When you override this package's global variables, think about localizing your local settings, so it won't affect other modules using this module in the same run. TODO
o provide an option to disable the coloring altogether via some flag or import() AUTHOR
Stas Bekman with contributions from Doug MacEachern perl v5.8.0 2002-05-19 Apache::TestTrace(3)

Check Out this Related Man Page

Agent::Priorities(3pm)					User Contributed Perl Documentation				    Agent::Priorities(3pm)

NAME
Log::Agent::Priorities - conversion between syslog priorities and levels SYNOPSIS
Not intended to be used directly DESCRIPTION
This package contains routines to convert between syslog priorities and logging levels: level_from_prio("crit") yields 2, and prio_from_level(4) yields "warning", as does prio_from_level(5). Here are the known priorities (which may be abbreviated to the first 2 letters, in a case-insensitive manner) and their corresponding logging level: Name Level Traditional Export --------- ----- -------------- ------ none -1 NONE (special, see text) emergency 0 (emerg, panic) EMERG alert 1 ALERT critical 2 (crit) CRIT error 3 (err) ERROR warning 4 WARN notice 6 NOTICE info 8 INFO debug 10 DEBUG The values between parenthesis show the traditional syslog priority tokens. The missing levels (5, 7, 9) are there for possible extension. They currently map to the level immediately below. The Export column lists the symbolic constants defined by this package. They can be imported selectively, or alltogether via the ":LEVELS" tag, as in: use Log::Agent::Priorities qw(:LEVELS); The special token "none" may be used (and spelled out fully) on special occasions: it maps to -1, and is convenient when specifying a logging level, for instance: specifying "none" ensures that no logging will take place, even for emergency situations. Anywhere where a priority is expected, one may specify a number taken as a logging level or a string taken as a priority. If the default mapping outlined above is not satisfactory, it can be redefined by specifying, for instance "notice:9". It will be taken as being of level 9, but with a "notice" priority nonetheless, not "info" as it would have been implicitely determined otherwise. The routine priority_level() decompiles "notice:9" into ("notice", 9), and otherwise uses prio_from_level() or level_from_prio() to compute the missing informatin. For instance, given "critical", priority_level() routine will return the tuple ("critical", 2). AUTHOR
Raphael Manfredi <Raphael_Manfredi@pobox.com> SEE ALSO
Log::Agent(3), Log::Agent::Logger(3). perl v5.10.0 2002-03-09 Agent::Priorities(3pm)
Man Page