Sign in to PrePAN

Log:Selective Selective logging to the console



use Log::Selective;
set_verbosity( 1 );                # Normally only show messages at or below level 1
extra_logging( 3, 'A|C' );         # Show up to level 3 for A() and C()

LOG( 0, "Normal output" );
LOG( 1, "Debug output" );
LOG( 2, "More debug output" );     # Not output to console
WARNING( "Foo looks funny" );
ERROR( "Bar not found" );

A(); B(); C(); D();

LOG( 0, "All done" );

show_warnings();                   # Show summary of warnings
show_errors();                     # Show summary of errors

sub A() {
    LOG( 3, "In A()" );

sub B() {
    LOG( 3, "In B()" );            # Not output to console

sub C() {
    LOG( 3, "In C()" );

sub D() {
    LOG( 1, "In D()" );


This module is a logger with adjustable verbosity for commandline programs. Different verbosity levels can have different colors and styles applied and specific functions or methods can get extra verbosity. Message colors and styles are fully user-definable.

Additional functions are provided for displaying summaries of all warnings or errors encountered. Stack traces can been shown on demand or whenever there are warnings or errors.

This is a strictly functional module (no use of objects or methods). Tests have yet to be written.
Full documentation is available here and usage examples can be found in the examples/ directory.



Please sign up to post a review.