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

Log::Handler::Levels(3pm)				User Contributed Perl Documentation				 Log::Handler::Levels(3pm)

NAME
Log::Handler::Levels - All levels for Log::Handler. DESCRIPTION
Base class for Log::Handler. Just for internal usage and documentation. METHODS
Default log level debug() info() notice() warning(), warn() error(), err() critical(), crit() alert() emergency(), emerg() Checking for active levels is_debug() is_info() is_notice() is_warning(), is_warn() is_error(), is_err() is_critical(), is_crit() is_alert() is_emergency(), is_emerg() Special level fatal() Alternative for the levels "critical" - "emergency". is_fatal() Check if one of the levels "critical" - "emergency" is active. Special methods trace() This method is very useful if you want to add a full backtrace to your message. Maybe you want to intercept unexpected errors and want to know who called "die()". $SIG{__DIE__} = sub { $log->trace(emergency => @_) }; By default the backtrace is logged as level "debug". # would log with the level debug $log->trace('who called who'); If you want to log with another level then you can pass the level as first argument: $log->trace(info => $message); dump() If you want to dump something then you can use "dump()". The default level is "debug". my %hash = (foo => 1, bar => 2); $log->dump(\%hash); If you want to log with another level then you can pass the level as first argument: $log->dump($level => \%hash); die() This method logs the message to the output and then call "Carp::croak()" with the level "emergency" by default. $log->die('an emergency error here'); If you want to log with another level, then you can pass the level as first argument: $log->die(fatal => 'an emergency error here'); log() With this method it's possible to log messages with the log level as first argument: $log->log(info => 'an info message'); Is the same like $log->info('an info message'); and $log->log('an info message'); If you log without a level then the default level is "info". PREREQUISITES
Carp Data::Dumper EXPORTS
No exports. REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. If you send me a mail then add Log::Handler into the subject. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-11-21 Log::Handler::Levels(3pm)
Man Page