in reply to logging only calls within a module

You can use the callbacks argument to the Log::Dispatch constructor:
my $logger = Log::Dispatch->new( ..., callbacks => \&package_filter, ); sub package_filter { my %message = @_; my ( $pkg, $file, $line ) = caller(3); # please check that 3 is th +e correct level for your situation # decide if the package $pkg should be logged if( should_log( $pkg ) ) { return $message{'message'}; } # otherwise, suppress this message return; }
Note that you can also pass an arrayref of callback functions to the Log::Dispatch constructor. They will be called in the specified order.

Replies are listed 'Best First'.
Re^2: logging only calls within a module
by szabgab (Priest) on Dec 05, 2006 at 18:46 UTC
    Yes, that's good though currently that is caller(6).

    The problem is only that I will need to be sure this is the correct number. I think I'll ask Dave if he would be ready to provide a method that would return this number. That way in case he changes something in the implementation I can still have the correct number.