diff --git a/modules/Bio/EnsEMBL/Utils/Exception.pm b/modules/Bio/EnsEMBL/Utils/Exception.pm index 596e012dec01a465f58ceb2c39bef0a91fdba8b7..dea57a230d424dee4be4904716b387ecff9909cb 100644 --- a/modules/Bio/EnsEMBL/Utils/Exception.pm +++ b/modules/Bio/EnsEMBL/Utils/Exception.pm @@ -170,11 +170,27 @@ sub warning { $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-------------------- WARNING ----------------------\n". "MSG: $string\n". - "FILE: $file LINE: $line\n" . - "---------------------------------------------------\n"; + "FILE: $file LINE: $line\n"; + $out .= "CALLED BY: $caller_file LINE: $caller_line\n" if($caller_file); + $out .= "---------------------------------------------------\n"; print STDERR $out; }