Bio::EnsEMBL::Analysis::Tools Logger
Included librariesPackage variablesGeneral documentationMethods
Toolbar
WebCvsRaw content
Package variables
Globals (from "use vars" definitions)
@EXPORT = qw(logger_verbosity logger_info)
Privates (from "my" definitions)
$DEFAULT_INFO_WITH_TRACE = 5000
$VERBOSITY = $DEFAULT_OFF
$DEFAULT_OFF = 0
$DEFAULT_INFO = 4000
Included modules
Bio::EnsEMBL::Utils::Exception qw ( verbose throw warning stack_trace_dump )
Exporter
Inherit
Exporter
Synopsis
No synopsis!
Description
No description!
Methods
logger_info
No description
Code
logger_verbosity
No description
Code
Methods description
None available.
Methods code
logger_infodescriptionprevnextTop
sub logger_info {
  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_verbositydescriptionprevnextTop
sub logger_verbosity {
  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;
}
General documentation
No general documentation available.