Log::Selective - Selectively choose what to log
use Log::Selective; Log::Selective::select(:tagA, :main); note "I'm here", :tagA; # prints "I'm here at somefile.pl line 3." note "Now I'm here", :tagB; # doesn't print, tagB isn't active note "And here too!"; # Implicit tag 'main', is printed
Log::Selective is a Perl 6 module for printing simple log messages to $ERR. It allows sets of messages to be selected by use of tags; messages whose tags haven't been selected won't be printed. It is designed for so-called "print-based debugging", but can be put to other uses as well.
$ERR
Log::Selective exports a single function, note, which is called with zero or more strings, followed by zero or more tags. The strings are printed to $ERR only if one or more of the tags have been "selected", either by giving them to the unexported Log::Selective::select function or by including them in the SELECT_LOGS environment variable. There is no facility to deselect a tag.
note
Log::Selective::select
SELECT_LOGS
A tag is always represented by a named parameter (pair). (The value of the pair is currently unused, but for forward compatibility it should always be the value 1, the default for the :name form.) By convention, tags are lowercase.
1
:name
If note is not provided with any tags, it will intuit one by extracting the last component of the calling function's package name. (For example, if a function in Some::Module called note without providing any tags, it would look for a tag named Module.) Since module names are typically capitalized, most "autotags" will be too.
Some::Module
Module
When activated, the special tag :all will cause all tracing messages to be printed, even if none of their tags match.
:all
None known. Report any to the author; patches are always appreciated.
Copyright (C) 2005 Brent Royal-Gordon <brent@brentdax.com>. All Rights Reserved.
This program is Free Software, and may be used, distributed and modified under the same terms as Perl itself.
To install Perl6::Pugs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Pugs
CPAN shell
perl -MCPAN -e shell install Perl6::Pugs
For more information on module installation, please visit the detailed CPAN module installation guide.