Algorithm-Genetic-Diploid
view release on metacpan or search on metacpan
lib/Algorithm/Genetic/Diploid/Logger.pm view on Meta::CPAN
# set verbosity at the level of classes
elsif ( $args{'class'} ) {
if ( ref $args{'class'} eq 'ARRAY' ) {
$VERBOSE{$_} = $args{'level'} for @{ $args{'class'} };
}
else {
$VERBOSE{$args{'class'}} = $args{'level'};
}
}
# set verbosity globally
else {
$VERBOSE = $args{'level'};
}
return $self;
}
=item formatter
Alters log string formatter. When argument is 'simple' the log string is just
the logging level and message, when argument is 'verbose', the log string has
lib/Algorithm/Genetic/Diploid/Logger.pm view on Meta::CPAN
# destructor does nothing
sub DESTROY {}
=back
=head1 VERBOSITY LEVELS
The following constants are available when using this package with the use qualifier
':levels', i.e. C<use Algorithm::Genetic::Diploid::Logger ':levels';>. They represent
different verbosity levels that can be set globally, and/or at package level, and/or
at method level.
=over
=item FATAL
Only most severe messages are transmitted.
=cut
lib/Algorithm/Genetic/Diploid/Logger.pm view on Meta::CPAN
my ( $self, $msg ) = @_;
my $method = $AUTOLOAD;
$method =~ s/.+://;
# only proceed if method was one of fatal..debug
if ( exists $levels{$method} ) {
my ( $package, $file1up, $line1up, $subroutine ) = caller( 1 );
my ( $pack0up, $filename, $line, $sub0up ) = caller( 0 );
# calculate what the verbosity is for the current context
# (either at sub, package or global level)
my $verbosity;
if ( exists $VERBOSE{$subroutine} ) {
$verbosity = $VERBOSE{$subroutine};
}
elsif ( exists $VERBOSE{$pack0up} ) {
$verbosity = $VERBOSE{$pack0up};
}
else {
$verbosity = $VERBOSE;
}
( run in 0.618 second using v1.01-cache-2.11-cpan-49f99fa48dc )