Included libraries | Package variables | General documentation | Methods |
WebCvs | Raw content |
logger_info | No description | Code |
logger_verbosity | No description | Code |
logger_info | description | prev | next | Top |
my $string = shift; if ($VERBOSITY < $DEFAULT_INFO) { return; } elsif ($VERBOSITY < $DEFAULT_INFO_WITH_TRACE) { print STDERR "INFO: $string\n"; return; } my @caller = caller; my $line = $caller[2] || ''; #use only 2 subdirs for brevity when reporting the filename}
my $file; my @path = split(/\//, $caller[1]); $file = pop(@path); my $i = 0; while(@path && $i < 2) { $i++; $file = pop(@path) ."/$file"; } @caller = caller(1); my $caller_line; my $caller_file; $i=0; if(@caller) { @path = split(/\//, $caller[1]); $caller_line = $caller[2]; $caller_file = pop(@path); while(@path && $i < 2) { $i++; $caller_file = pop(@path) ."/$caller_file"; } } my $out = "\n-------------------- LOG INFO ---------------------\n". "MSG: $string\n". "FILE: $file LINE: $line\n"; $out .= "CALLED BY: $caller_file LINE: $caller_line\n" if($caller_file); $out .= "---------------------------------------------------\n"; print STDERR $out; } 1;
logger_verbosity | description | prev | next | Top |
if(@_) { my $verbosity = shift; $verbosity = shift if($verbosity && $verbosity eq "Bio::EnsEMBL::Utils::Exception"); $verbosity = $VERBOSITY if(!$verbosity); if($verbosity =~ /\d+/) { #check if verbosity is an integer}
$VERBOSITY = $verbosity; } else { if($verbosity eq 'OFF' || $verbosity eq 'NOTHING' || $verbosity eq 'NONE'){ $VERBOSITY = $DEFAULT_OFF; }elsif($verbosity eq 'INFO' || $verbosity eq 'LOGGER_INFO'){ $VERBOSITY = $DEFAULT_INFO; } elsif ($verbosity eq 'INFO_STACK_TRACE' || $verbosity eq 'LOGGER_INFO_STACK_TRACE') { $VERBOSITY = $DEFAULT_INFO_WITH_TRACE; } elsif($verbosity eq 'ALL' || 'ON'){ $VERBOSITY = 1e6; } else { $VERBOSITY = $DEFAULT_OFF; warning("Unknown level or verbosity :".$verbosity); } } } return $VERBOSITY;