package WebGUI::ErrorHandler; #------------------------------------------------------------------- # WebGUI is Copyright 2001 Plain Black Software. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use FileHandle; use WebGUI::Session; #------------------------------------------------------------------- sub fatalError { my ($key, $log, $cgi, $logfile, $config); if (exists $session{cgi}) { $cgi = $session{cgi}; } else { use CGI; $cgi = CGI->new; } print $cgi->header; if (exists $session{config}{logfile}) { $logfile = $session{config}{logfile}; } else { use Data::Config; $config = new Data::Config '../etc/WebGUI.conf'; $logfile = $config->param('logfile'); } $log = FileHandle->new(">>$logfile") or die "Can't open log file."; print "
";
print $0." at ".localtime(time)." reported:
";
print $log localtime(time)." ".$0." ".$_[0]."\n";
print $_[0];
print "
| ";
print "Level 1 ".join(" ",caller(1)); print $log "\t".join(",",caller(1))."\n"; print " | "."Level 2 ".join(" ",caller(2)); print $log "\t".join(",",caller(2))."\n"; print " | "."Level 3 ".join(" ",caller(3)); print $log "\t".join(",",caller(3))."\n"; print " | "."Level 4 ".join(" ",caller(4)); print $log "\t".join(",",caller(4))."\n"; print " |