&set_debug_context();
&set_error_context();
+# Setup intercept routines for die and warn in order to log their infomation
+$main::SIG{'__DIE__'} = sub { if ( defined $^S && ! $^S && defined $errlog)
+ { $errlog->log("die(): " . $_[0]); } };
+$main::SIG{'__WARN__'} = sub { if ( defined $^S && ! $^S && defined $errlog)
+ { $errlog->log("warn(): " . $_[0]); } };
+
# This function is used to set the debug logging context
sub set_debug_context {
undef $errlog;
}
-sub error {
+sub log {
my( $message ) = @_;
# if the error logger is not defined, create it.
if ( ! defined $errlog ) { &open_error_log(); }
+
+ $errlog->log("$message");
+}
+
+sub error {
+ my( $message ) = @_;
- $errlog->log("Error: $message");
+ &log("Error: $message");
}
sub debug {