# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
package Amanda::Debug;
+*debug_init = *Amanda::Debugc::debug_init;
*dbopen = *Amanda::Debugc::dbopen;
*dbreopen = *Amanda::Debugc::dbreopen;
*dbrename = *Amanda::Debugc::dbrename;
=head1 SYNOPSIS
- use Amanda::Debug qw( :init :logging );
+ use Amanda::Util qw( :constants );
- # (note: dbopen and such are usually handled by
- # Amanda::Util::setup_applicaton)
- dbopen("server");
+ Amanda::Util::setup_application("amcooltool", "server", $CONTEXT_CMDLINE);
debug("this is a debug message");
+ die("Unable to frobnicate the ergonator");
-See C<debug.h> for a more in-depth description of the functionality of
+See C<debug.h> for a more in-depth description of the logging functionality of
this module.
=head1 API STATUS
=head1 DEBUG LOGGING
-Several debug logging messages, each taking a single string, are
+Several debug logging functions, each taking a single string, are
available:
=over
=back
-ALl of the debug logging functions are available via the export tag
+Perl's built-in C<die> and C<warn> functions are patched to call C<critical>
+and C<warning>, respectively.
+
+All of the debug logging functions are available via the export tag
C<:logging>.
=head1 ADVANCED USAGE
=cut
-push @EXPORT_OK, qw(dbopen dbreopen dbrename dbclose
+push @EXPORT_OK, qw(debug_init dbopen dbreopen dbrename dbclose
$erroutput_type $error_exit_status);
-push @{$EXPORT_TAGS{"init"}}, qw(dbopen dbreopen dbrename dbclose
+push @{$EXPORT_TAGS{"init"}}, qw(debug_init dbopen dbreopen dbrename dbclose
$erroutput_type $error_exit_status);
push @EXPORT_OK, qw(erroutput_type_t_to_strings);
$_erroutput_type_t_VALUES{"AMANDALOG"} = $ERR_AMANDALOG;
+sub _my_die {
+ # $^S is set if we're in an eval { .. }, in which case we want
+ # to use the default Perl semantics.
+ if ($^S) {
+ die(@_);
+ } else {
+ my ($msg) = @_;
+ chomp $msg;
+ critical(@_);
+ }
+};
+$SIG{__DIE__} = \&my_die;
+
+sub _my_warn {
+ my ($msg) = @_;
+ chomp $msg;
+ warning(@_);
+};
+$SIG{__WARN__} = \&my_warn;
+
+# utility function for test scripts, which want to use the regular
+# perl mechanisms
+sub disable_die_override {
+ delete $SIG{__DIE__};
+ delete $SIG{__WARN__};
+}
+
push @EXPORT_OK, qw(error critical warning message info debug);
push @{$EXPORT_TAGS{"logging"}}, qw(error critical warning message info debug);
1;